name = 'adams'
c = 2x+4
I would like the value of "name" to be the variable for c. Therefore, instead of:
c = 2x+4
it would be:
adams = 2x+4

5 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 1 日
Can you explain?
Leyon
Leyon 2013 年 11 月 1 日
Instead of a hardwire variable I would would like the output assigned to a variable that is created. For example when using xlsread the output file is assigned the name of the file being imported. How is that done?
dpb
dpb 2013 年 11 月 1 日
Leyon
Leyon 2013 年 11 月 1 日
So the only option seems to be to create struct variables?
Thanks. i already knew this but was hoping there was another alternative so I could have a clean fieldname
Matt J
Matt J 2013 年 11 月 1 日
編集済み: Matt J 2013 年 11 月 1 日
It isn't the only option, but I recommended it to you here
as the safest one. There are dangers in using assignin, eval, load, etc... to create variables inexplicitly. See, for example,

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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 1 日

0 投票

a=[2 4 5];
assignin('base','adams',a)

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 1 日
But I don't see why it's important to change the name of your variable?

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2013 年 11 月 1 日

編集済み:

2013 年 11 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by