Pass data in subcells in a cell array to double-type data

1 回表示 (過去 30 日間)
Maria
Maria 2014 年 7 月 23 日
コメント済み: Maria 2014 年 7 月 23 日
I have a cell array with 5 columns and the same number of rows. Two of the columns comprise text-data (char type), other two columns comprise numbers (double type) and one column has sub-cells which are in their turn numbers too (double type). I am used to work with cell-arrays with both text and numbers, but I am having difficulties to go on with my code with the sub-cells in one of the columns. Does someone know how to change the sub-cells to regular double-type elements?
Thank you
  2 件のコメント
Sara
Sara 2014 年 7 月 23 日
Have you tried cell2mat?
Maria
Maria 2014 年 7 月 23 日
Sara yes, it says 'Cell2mat cannot support cell arrays containing cell arrays or objects.'

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 23 日
If your data looks like this:
A={'a' 'b' 1 2 {3};'c' 'd' 4 5 {6}}
A(:,5)=cellfun(@(x) x{1} ,A(:,5),'un',0)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by