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 !

 採用された回答

Stephen23
Stephen23 2019 年 9 月 15 日

1 投票

1 件のコメント

Hakan Basargan
Hakan Basargan 2019 年 9 月 16 日
Thank you for your useful answer :)

サインインしてコメントする。

その他の回答 (1 件)

Guillaume
Guillaume 2019 年 9 月 15 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

リリース

R2019a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by