put all cells in one column cellfun

2 ビュー (過去 30 日間)
NA
NA 2019 年 1 月 24 日
コメント済み: madhan ravi 2019 年 1 月 24 日
I have
q1={[1],[3],[4]};
q2={[1;3],[3;4],[4;5]};
q3={[1;2;3;4;5;5],[1;2;3;4;5;67],[1;6;3;4;9;67]};
I use this code but not working
out= cellfun(@(w,e,r)(w;e;r),q1,q2,q3,'uni',0);
out={[1;1;3;1;2;3;4;5;5],[3;3;4;1;2;3;4;5;67],[4;4;5;1;6;3;4;9;67]}

採用された回答

madhan ravi
madhan ravi 2019 年 1 月 24 日
out= cellfun(@(w,e,r)[w;e;r],q1,q2,q3,'uni',0);
% ^-----^------- square bracket!
  2 件のコメント
Stephen23
Stephen23 2019 年 1 月 24 日
編集済み: Stephen23 2019 年 1 月 24 日
Correct brackets solves the problem. A simpler solution: @vertcat
madhan ravi
madhan ravi 2019 年 1 月 24 日
Agree with stephen:
out= cellfun(@vertcat,q1,q2,q3,'un',0);

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

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