how to convert a string into matrix of specified dimension

2 visualizaciones (últimos 30 días)
lafnath p
lafnath p el 24 de Oct. de 2016
Respondida: KSSV el 24 de Oct. de 2016
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]

Respuestas (1)

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

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by