フィルターのクリア

Matching value to corresponding variable via string name

1 回表示 (過去 30 日間)
Colin
Colin 2014 年 8 月 21 日
回答済み: Honglei Chen 2014 年 8 月 21 日
Hello All,
I am currently engaged in trying to create a new variable (ex. YO) which is equal to the value of another variable (ex. ANOTHER), however this must be carried out by only knowing a string which contains the second variable (i.e. ANOTHER). The example below should clarify:
ANOTHER=20;
myvec=('ANOTHER');
YO=f(myvec); %function which would make YO=20
Any assistance in how to build this "function" (not really a function file) would be greatly appreciated, as I've been stumped on this for about a day now!

採用された回答

Honglei Chen
Honglei Chen 2014 年 8 月 21 日
YO = eval(myvec)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by