Effacer les filtres
Effacer les filtres

Executing loops for specific number of times.

2 vues (au cours des 30 derniers jours)
Raghavendra Reddy P
Raghavendra Reddy P le 12 Fév 2015
Modifié(e) : per isakson le 12 Fév 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...

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by