Comments on: How to add to a cell array in MATLAB https://blogs.mathworks.com/videos/2011/01/13/how-to-add-to-a-cell-array-in-matlab/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Fri, 14 Jan 2011 19:27:02 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: dhull https://blogs.mathworks.com/videos/2011/01/13/how-to-add-to-a-cell-array-in-matlab/#comment-2518 Fri, 14 Jan 2011 19:27:02 +0000 https://blogs.mathworks.com/videos/2011/01/13/how-to-add-to-a-cell-array-in-matlab/#comment-2518 @Louis,

There are many ways to do things in MATLAB and other languages. I tend to prefer code that is easiest to read as my first metric. It is good to know of more robust, if not more cryptic, techniques. There are places where your solution would be much better.

Thanks for adding it.

Doug

]]>
By: Louis https://blogs.mathworks.com/videos/2011/01/13/how-to-add-to-a-cell-array-in-matlab/#comment-2517 Fri, 14 Jan 2011 14:13:19 +0000 https://blogs.mathworks.com/videos/2011/01/13/how-to-add-to-a-cell-array-in-matlab/#comment-2517 I have determined a programmatic way to do the same. I welcome comments on this approach.

load('data.mat')
newRow = cellfun(@(x)(cast([],class(x))),data(1,:),'UniformOutput',false)
data = cat(1,data,newRow)

~Louis

]]>