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

1 visualización (últimos 30 días)
Bojan
Bojan el 9 de Jun. de 2014
Respondida: Sara el 9 de Jun. de 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

Respuestas (1)

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

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by