Efficiency help
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, i need some more help with effeciency. This following code is running very slowly (took over 800 seconds for one of my data sets)
for l= 1:listsize;
for m = 1:length(peak_loc2{l});
counter2 =1;
while peak_loc2{l}(m)~= mymatrix2(1, counter2)
counter2=counter2+1;
end
mymatrix2(2,counter2) = mymatrix2(2,counter2) +1;
end
end
here listsize is 271 peak_loc2 is a list of cell, around 100 cells, each containing anywhere from 2 to a few hundred variables
mymatrix2 is a 2X3000s that list all the peaks in peak_loc2, and non-recurring
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 7 Dez. 2011
you can replace the while loop with
counter2 = find(mymatrix(1,:)==peak_loc2{1}(m),1,'first')
5 Kommentare
Sean de Wolski
am 7 Dez. 2011
If you have over 3000 variables there's something we're not seeing. Perhaps you could post a sample matrix (small) or a *.mat file to somewhere.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!