Variable in Text [Matlab]

조회 수: 3 (최근 30일)
Hakan Basargan
Hakan Basargan 2019년 9월 15일
댓글: Hakan Basargan 2019년 9월 16일
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
Hakan Basargan
Hakan Basargan 2019년 9월 16일
Thank you for your useful answer :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Guillaume
Guillaume 2019년 9월 15일
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.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by