Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
Bojan
Bojan am 9 Jun. 2014
Beantwortet: Sara am 9 Jun. 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

Antworten (1)

Sara
Sara am 9 Jun. 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

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by