Turning a char element in a double array
显示 更早的评论
How can I turn a char element into an array of double values. I am trying to get the Expected Output below but array_convert does not work. How would I be able to get the Expected Output below?
Code:
a = char('[21,12,43,1]')
array_convert= str2double(a)
Expected Output:
[21 12 43 1]
回答(1 个)
a = char('[21,12,43,1]');
array_convert = str2num(a)
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!