Conversion from char to matrix
52 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I've a char array that looks like this:
numb = [2:4 6:2:12 17 25 26:28 35 37 38:41 46]
Is there a way that I can change it to a matrix so that I can use the numbers in the char array?
Thanks a lot in advance.
Best,
Eric
1 个评论
Stephen23
2016-12-3
The array you show is numeric, not char:
>> numb = [2:4 6:2:12 17 25 26:28 35 37 38:41 46];
>> class(numb)
ans = double
回答(1 个)
Walter Roberson
2016-12-3
numb = '[2:4 6:2:12 17 25 26:28 35 37 38:41 46]';
nn = str2num(numb);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!