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!