Optimizing my code for sorting large data set

My program takes data from a large table and sorts each line into a 3-dimensional array based off the value in one of the column elements. Here is the code for the sort:
for g = 1:spots
disp('Sorting data');
f=1;
for h=(g-1)*fs+1:fs+fs*(g-1)
if tblB{h,2} == g
for i=1:7
data(f,i,g)= tblB{h,i};
end
f=f+1;
end
end
end
Sample table data:
FrameNumber Spot ID X Y Z Radius Orientation
00 255 380 474 27. 0 0
Spots is the number that the sort queues off of the table. Right now the program goes line by line through the program and the if statement compared the value in the table to spots. I am trying to sort almost upwards of 2 million lines from the table. Each "spots" value will have roughly 100,000 elements. The sort as is takes a long time to sift through the data. Any help would be appreciated.

Risposte (0)

Categorie

Richiesto:

il 30 Giu 2014

Modificato:

il 30 Giu 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by