How to extract a string name from a cell array and use it as name for a new variable?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to make matlab use a string which was previously saved in a cell array for the construction of a new variable name...how can I do this?
eg.
A={'wind force', 'temperature', 'humidity'}
%define a new variable temperature
temperature=input('temperature', 's')
0 件のコメント
回答 (1 件)
Wayne King
2012 年 6 月 10 日
Are you sure you want them to input the temperature as a string?
A={'wind force', 'temperature', 'humidity'};
temperature = input(A{2});
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!