필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
Bojan
Bojan 2014년 6월 9일
답변: Sara 2014년 6월 9일
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

답변 (1개)

Sara
Sara 2014년 6월 9일
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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by