Reading the data from another m file in a loop
Afficher commentaires plus anciens
Hi guys, I created two functions, in the second one I'd like to read the data from the first one like this but in a smarter way, is it possible to use a loop somehow here? I'd like to read from t1 till t4 and from y1 till y50 and it's not convinient to write every single variable.
t1=model.t1;
t2=model.t2;
t3=model.t3;
t4=model.t4;
y1=model.y1;
y2=model.y2;
y3=model.y3;
y4=model.y4;
y5=model.y5;
y6=model.y6;
y7=model.y7;
y8=model.y8;
y9=model.y9;
y10=model.y10;
1 commentaire
dpb
le 6 Mai 2022
Use arrays and/or named fields instead -- don't create a sequence of variable names like this to begin with.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!