Effacer les filtres
Effacer les filtres

Variable in Text [Matlab]

2 vues (au cours des 30 derniers jours)
Hakan Basargan
Hakan Basargan le 15 Sep 2019
Commenté : Hakan Basargan le 16 Sep 2019
Hi Team!
I havea brief question. I would like to use variable as below:
branch_ego.step.step"i".branch"j"
It's going to be like branch_ego.step.step1.branch1, branch_ego.step.step1.branch2, branch_ego.step.step2.branch3 etc.
How can I implement variable to the text variable ?
Thanks !

Réponse acceptée

Stephen23
Stephen23 le 15 Sep 2019
  1 commentaire
Hakan Basargan
Hakan Basargan le 16 Sep 2019
Thank you for your useful answer :)

Connectez-vous pour commenter.

Plus de réponses (1)

Guillaume
Guillaume le 15 Sep 2019
How can I implement variable to the text variable
You don't! Numbered variables are always a bad idea. Instead you use indexing:
branch.ego.step.step(i).branch(j) = ...
See why variables should not be named dynamically for all the reasons why your initial request is a very bad idea.

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by