Re: Plotting cells on one graph with different colors
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Wed, 31 Oct 2007 21:15:54 +0000 (UTC)
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
.
- References:
- Plotting cells on one graph with different colors
- From: jp
- Re: Plotting cells on one graph with different colors
- From: Walter Roberson
- Re: Plotting cells on one graph with different colors
- From: jp
- Plotting cells on one graph with different colors
- Prev by Date: Help with Matlab loops
- Next by Date: Pixelated text in GUI
- Previous by thread: Re: Plotting cells on one graph with different colors
- Next by thread: Re: Plotting cells on one graph with different colors
- Index(es):