how to convert a string into matrix of specified dimension

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]

Answers (1)

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

Categories

Tags

Asked:

on 24 Oct 2016

Answered:

on 24 Oct 2016

Community Treasure Hunt

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

Start Hunting!