Matlab Variable Naming For Another Variable

I have a question. I want "a" to be "h", which varies according to the value of "a" depending on some variables. For example, if a = 2x + y, a = 4 for x = 1 y = 2, show "ha" as "h4" and see the value of "h4". How can i do it?

回答 (1 件)

Chidvi Modala
Chidvi Modala 2020 年 8 月 7 日

0 投票

You can make use of the following piece of code
for i=1:3
eval(['A' num2str(i)])
end
But there are many disadvantages of using this method. The following links might be of help to you for other workarounds

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

質問済み:

2020 年 8 月 4 日

回答済み:

2020 年 8 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by