Azzera filtri
Azzera filtri

use goto, jump or some easier way for my loop in matlab?

4 visualizzazioni (ultimi 30 giorni)
Bojan
Bojan il 9 Giu 2014
Risposto: Sara il 9 Giu 2014
I have this code
values_nodelay=no_of_values(2:2:end)
no_of_values_x1=(find(u~=[u(2:end), u(end)+1]));
no_of_values_x1=no_of_values_x1(2:2:end)
l=1;
delay=2;
values_delay=[];
while l<=length(values_nodelay)
values_delay_temp=values_nodelay(l)-delay;
if delay>values_delay_temp
end
values_delay=[values_delay, values_delay_temp];
l=l+1;
end
values_delay
i need a goto or jump function to the beginning of while, or if anyone know easier way maybe easier way, that if my delay>values_delay_temp i do not want to put in my final vector values_delay i wan to jump it and continue again with while loop. thanks guys

Risposte (1)

Sara
Sara il 9 Giu 2014
You can change the condition in your if and put the value in values_delay only when delay<=values_delay_temp
while l<=length(values_nodelay)
values_delay_temp=values_nodelay(l)-delay;
if delay<=values_delay_temp
values_delay=[values_delay, values_delay_temp];
end
l=l+1;
end

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by