split comma-separated rows into separate columns

1 回表示 (過去 30 日間)
Tha saliem
Tha saliem 2017 年 4 月 14 日
コメント済み: Tha saliem 2017 年 4 月 14 日
hey i want to know how to split comma-separated rows into separate columns in cell array elements e.g.
x{4x1 cell}
x{1,1}{1,1}=[2,1,2,3]
& all other elements in this form.
result should be like this:
result{1,1}{1,1}=[2;1;2;3]
thanks in advance
  2 件のコメント
Stephen23
Stephen23 2017 年 4 月 14 日
Are these "comma-separated rows" numeric vectors, or strings? From your description it is not clear what form or type the data has.
Tha saliem
Tha saliem 2017 年 4 月 14 日
these have numeric value both positive and negative like 4 & -4

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2017 年 4 月 14 日
編集済み: Stephen23 2017 年 4 月 14 日
>> Z = cellfun(@(c)cellfun(@(v)v(:),c,'uni',0),x,'uni',0)
Z =
{1x1 cell}
>> Z{1}{1}
ans =
2
1
2
3
Although your code would be a lot simpler if you did not use nested cell arrays in the first place.
  1 件のコメント
Tha saliem
Tha saliem 2017 年 4 月 14 日
Thanks alot for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by