Azzera filtri
Azzera filtri

Executing loops for specific number of times.

2 visualizzazioni (ultimi 30 giorni)
Raghavendra Reddy P
Raghavendra Reddy P il 12 Feb 2015
Modificato: per isakson il 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...

Risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by