speed optimization in "for" loops
Ältere Kommentare anzeigen
Hi,
I have an experiment with 864 trials. I have an array named Edf_Trials3, with data of saccadic eye movements during the entire experiment. In some trials I have more than one eye movement, in others there is none.
I have an other array, named Time_EndPpt6, with the time of the stimuli presentation in each trial.
I would like to add the time of the stimuli presentation in the former array "Edf_Trials3", on the same line of the corresponding trial.
For that i'm using 2 loops but it's very very long.
Could you help to simplify my code in order to boost the process ?
I add the two arrays. this is my code:
for (j=1:height(Edf_Trials3))
for(i=1:length(Time_EndPpt6))
if (Edf_Trials3.Trial(j)==i)
Edf_Trials3.EndTime_of_Ppt(j)=Time_EndPpt6(i);
end
end
end
Thanks for your help
1 Kommentar
Jan
am 24 Okt. 2018
I'd omit the strange parentheses for the for and if commands. It works, but does not look Matlabish.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!