how to convert a string into matrix of specified dimension

조회 수: 1 (최근 30일)
lafnath p
lafnath p 2016년 10월 24일
답변: KSSV 2016년 10월 24일
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에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by