can any one tell how this break function works in this loop??
Show older comments
can any one tell me how the break functions if there are two if conditions in a for loop ...
if true
% code
end
locs_Qwave=[ 100 150 90 1175 1 50]';
locs_Rwave=[116 170]';
q=0
k=1
for j=k:size(locs_Rwave)
for i=1:numel(locs_Qwave)
if (i== numel(locs_Qwave))
q=[q locs_Qwave(i)];
break;
end
if( locs_Qwave(i)>locs_Rwave(j))
q=[q locs_Qwave(i-1)];
break;
end
end
end
Accepted Answer
More Answers (1)
Image Analyst
on 15 Sep 2014
0 votes
It looks like it should function. What's the problem? If either of those two conditions is met, it breaks out of the "i" for loop and continues on with the "j" for loop.
1 Comment
Abhishek sadasivan
on 15 Sep 2014
Categories
Find more on Programming 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!