フィルターのクリア

Concatenating doubles in cell arrays

1 回表示 (過去 30 日間)
MiauMiau
MiauMiau 2017 年 1 月 24 日
コメント済み: Stephen23 2017 年 1 月 24 日
Hi
I have two cell arrays, each of them 1x25. Each contains a 2x1 double array in the first 24 elements, and a 60x1 double array in the 25. I want to combine the two such that a new cell array would have a format of 1x25 as well, containing a 4x1 double array (concatenating of the original double arrays) in the first 24 elements, and a 120x1 double array in its 25th element - how can I do that? Thanks

採用された回答

Stephen23
Stephen23 2017 年 1 月 24 日
編集済み: Stephen23 2017 年 1 月 24 日
Where A and B are the input cell arrays:
cellfun(@(a,b)[a;b],A,B,'UniformOutput',false)
Or even
cellfun(@vertcat,A,B,'UniformOutput',false)
  2 件のコメント
MiauMiau
MiauMiau 2017 年 1 月 24 日
wow thanks. Is there a way to have the values in the double arrays order from min to max? thanks thanks thanks
Stephen23
Stephen23 2017 年 1 月 24 日
cellfun(@(a,b)sort([a;b]),A,B,'UniformOutput',false)

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

その他の回答 (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