Filter löschen
Filter löschen

Executing loops for specific number of times.

2 Ansichten (letzte 30 Tage)
Raghavendra Reddy P
Raghavendra Reddy P am 12 Feb. 2015
Bearbeitet: per isakson am 12 Feb. 2015
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...

Antworten (0)

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