Converting complex cells into simple cell arrays

1 回表示 (過去 30 日間)
lucksBi
lucksBi 2018 年 9 月 6 日
コメント済み: lucksBi 2018 年 9 月 7 日
HI
i have a question that how can i convert complex cell arrays into simple ones?
array = {[1x2 cell' char(10) ' ' char(10) '],[1x3 cell' char(10) ' ' char(10) '],[1x2 cell' char(10) ' ' char(10) ']}
in which
array{1,1}={0.7,0.3}
array{1,2}={1,0.6,0.5}
array{1,3}= {1,0.3}
i want to convert into array like this:
newArray= {[0.7,0.3],[1,0.6,0.5],[1,0.3]}

採用された回答

OCDER
OCDER 2018 年 9 月 6 日
array{1,1}={0.7,0.3};
array{1,2}={1,0.6,0.5};
array{1,3}= {1,0.3};
newArray = cellfun(@(x) cell2mat(x), array, 'un', 0);
newArray =
[1×2 double] [1×3 double] [1×2 double]

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by