Convert cell to matrix
1 次查看(过去 30 天)
显示 更早的评论
I have the following {'128' '256' '157' '54'} How can I convert it to a numeric matrix for example 128 256 157 54
采纳的回答
更多回答(1 个)
Jan
2013-10-6
Faster than str2double:
C = {'128' '256' '157' '54'};
S = sprintf('%s*', C{:});
D = sscanf(S, '%g*');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!