how to convert a string into matrix of specified dimension

1 Ansicht (letzte 30 Tage)
lafnath p
lafnath p am 24 Okt. 2016
Beantwortet: KSSV am 24 Okt. 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]

Antworten (1)

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

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by