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.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

질문:

2014년 6월 30일

편집:

2014년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by