how to split and transpose a cell array?
1 回表示 (過去 30 日間)
古いコメントを表示
Viridiana Torres
2016 年 4 月 29 日
コメント済み: Viridiana Torres
2016 年 4 月 30 日
Hi !! I have the next cell composition (30*1 size)
What I want to do is to split it first, according to the "," so each different number has to occupy a diffierent column. Like this:
After this, I want to transpose all the numbers, so I want to have a final matrix size (7*30)
Can anyone help me to solve this?
Thanks in advance!
0 件のコメント
採用された回答
Azzi Abdelmalek
2016 年 4 月 29 日
a={'12,13,14,45';'4,8,nan,nan';'450,2,14,nan'}
out=cell2mat(cellfun(@(x) str2num(strrep(x,',',' ')),a,'un',0))'
4 件のコメント
Azzi Abdelmalek
2016 年 4 月 29 日
編集済み: Azzi Abdelmalek
2016 年 4 月 29 日
This is not a problem, you know how to transpose a matrix?
out=out'
Now, for your previous comment, please post an example. It seems that your data are not similar to my example.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!