Re: Plotting cells on one graph with different colors



In article <1193857688.697383.250910@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
jp <jpopovich@xxxxxxxxx> wrote:
On Oct 30, 8:27 pm, rober...@xxxxxxxxxxxxxxxxxx (Walter Roberson)
wrote:
Are all the cell entries the same size? e.g.,
plot(1:length(data{1}), vertcat(data{:}))

Yes the data were all the same length and the data within the cell was
a column vector so I changed vertcat to horzcat and it worked
perfectly! Thank you! I tried to change the length of the data in
the cell, but was unable to use the same command. Is there a way to
perform the same thing with different vector lengths? Perhaps a
loop..by changing the length of x, but I don't see how you would be
able to change the colors that way.

If the cells may have different lengths, then you could pad
the shorter cells with NaN to the length of the longest

Possibly this (untested):

bigcell = max(cellfun(@length,data));
paddata = cellfun(@(v) [v; nan(bigcell-length(v),1)], data, ...
'UniformOutput', 0);
plot(1:bigcell, horzcat(paddata{:}));
--
"Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us." -- Ecclesiastes
.