How to convert cell to double array?
显示 更早的评论
My data is with size of 2050x1 and its class label as 'cell', how do convert it into double so that i can plot the graph? thanks for the help in advance
采纳的回答
更多回答(2 个)
Damdae
2019-7-27
Try str2double:
cell2mat({'01'}) = '01' (double)
str2double({'01'}) = 1 (char)
1 个评论
Giuseppe Degan Di Dieco
2021-11-29
Thanks Damdae, very useful tip to convert
cell array, containg numbers, to double.
Best.
The absolute easiest way I know is comma seperated list assignment, which looks like this;
a = [{25}; {31}; {24}; {5}; {23}; {64}; {12}; {53}; {22}];
b = [a{:}]'
I don't know whrether it is any good, but it works if the values of all cells are of the same type. just keep in mind that it will transpose a columnvector to a rowvector.
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!