how to convert a string into matrix of specified dimension

2 次查看(过去 30 天)
if string str='1,2,3,6,7,9,88,89,99' how it can be converted into a matrix as matrix=[1 2 3;6 7 9;88 89 99]

回答(1 个)

KSSV
KSSV 2016-10-24
str='1,2,3,6,7,9,88,89,99' ;
s = str2num(str) ;
matrix = reshape(s,3,[])'

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by