Effacer les filtres
Effacer les filtres

Skipping part of an index in a for-loop

13 vues (au cours des 30 derniers jours)
Robert Mason
Robert Mason le 31 Juil 2016
Réponse apportée : dpb le 31 Juil 2016
I have a set of data and a for-loop, for instance:
d(1) = 1;
d(2) = 2;
d(3) = 3;
for j= [1 3];
g = d(3)./(d + d(3));
end;
I would like the for-loop to skip one of the numbers in the index (for instance, 2). How can I go about coding this up?

Réponses (1)

dpb
dpb le 31 Juil 2016
nDont=2;
for j...
if j==nDont, continue, end
...
doc continue % for details

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by