to speed up 'for' loop
Show older comments
hello,
i have a loop with the following format:
for n = 1:length(x)
if ....
.....
elseif ....
.......
end
end
I suspect that it takes too long and my program is stuck. the length of 'x' currently 1200 cells and it might vary. How can I speed this up?
thanks,
5 Comments
Walter Roberson
on 1 Aug 2012
Please review the guide to tags and retag this; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Oleg Komarov
on 1 Aug 2012
Edited: Oleg Komarov
on 1 Aug 2012
You haven't posted the relevant info.
What are you specifically doing inside the loop, what type of inputs, size you have, have you preallocated?
W/o this info is hard to say.
Michael Adelman
on 2 Aug 2012
Rick Rosson
on 2 Aug 2012
Please post the actual and complete code...
Michael Adelman
on 3 Aug 2012
Accepted Answer
More Answers (1)
Michael Adelman
on 3 Aug 2012
0 votes
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!