put all cells in one column cellfun

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by