Effacer les filtres
Effacer les filtres

correct syntax for appending number to word in for loop

1 vue (au cours des 30 derniers jours)
John
John le 18 Nov 2013
Modifié(e) : John le 18 Nov 2013
Hello,
I was wondering if somebody could help me with a for loop.
In the for loop below, what would be the correct syntax be to make the variable dt equal to dt1 in the first loop? How do you append a 1 onto the dt? So that dt = dt1?
Thank you for your help
Journeynumber=3;
dt1=2;
at1=4;
dt2=7;
at2=8;
for j=1:Journeynumber
dt = dt"j";
end

Réponse acceptée

Doug Hull
Doug Hull le 18 Nov 2013
for i = 1:10;
str = ['dt' num2str(i)]
end
  1 commentaire
John
John le 18 Nov 2013
Modifié(e) : John le 18 Nov 2013
Thanks for your help.
How could I make the dt in the loop equal to the dt1 defined above (i.e. 2)?
At the moment dt = dt1 but what I want is dt1 = 2 in the loop.
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

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