From string to a variable
显示 更早的评论
Hi everybody, i've a string array array={'dog', 'bike', 'donut'} for example from here i need, for each word, a numeric variable with the same name
dog = 5;
bike = 7;
donut = 54;
(doesn't matter the numbers the most importan thing is to create the variable from the string in array )
采纳的回答
更多回答(2 个)
Paulo Silva
2011-4-18
assignin('base',char(array(1)),5)
assignin('base',char(array(2)),7)
assignin('base',char(array(3)),54)
Walter Roberson
2011-4-18
0 个投票
类别
在 帮助中心 和 File Exchange 中查找有关 Elementary Math 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!