can any one tell how this break function works in this loop??
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 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 commentaire
Abhishek sadasivan
le 15 Sep 2014
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!