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 Center および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by