Executing loops for specific number of times.

조회 수: 1 (최근 30일)
Raghavendra Reddy P
Raghavendra Reddy P 2015년 2월 12일
편집: per isakson 2015년 2월 12일
I have vectors x=[3 5 8 10] and v=1:12 starting from last element of vector x i.e 10 8 5 3 in reverse order i want to do following stuff
for i=1:12
if x=10
v(i)=v(i)-[real(p(i))*r(i)];
next if x=8
v(i)=v(i)-[real(p(i))*r(i)];
...
..
....
it has to complete till x=3
v(i)=v(i)-[real(p(i))*r(i)];
end
before hand i dont know how many elements are there in vector x and loop should start from last element of x to first...

답변 (0개)

카테고리

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