Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Reference a vector to a plot
Replies: 6   Last Post: Jan 20, 2011 5:05 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Markus Due Jakobsen

Posts: 43
Registered: 4/29/08
Re: Reference a vector to a plot
Posted: Nov 30, 2010 4:13 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Walter Roberson <roberson@hushmail.com> wrote in message <id3nfb$6jm$1@canopus.cc.umanitoba.ca>...
> On 10-11-30 02:05 PM, Markus Due Jakobsen wrote:
>

> > Thanks a lot for your reply, this was very helpful.
> > However, the refreshdata method doesn&#8217;t seem to work with
> > multiline plots.
> >
> > %% Example:
> > y = rand(100,3); h = plot(y); set(h,'YDataSource','y');
> > pause(1)
> > y=y(1:10,:);
> > refreshdata(h);

> >>> ??? Error using ==> refreshdata at 58
> >>> Could not refresh YData from 'y'.

> >
> > How can this be and is there a way to work around it?

>
> When you change the number of columns, you are changing the number of lines
> plotted; I am not surprised that this gives problems. For example if the
> number of lines to be plotted increases, there would have to be variables or
> settings to control the line style and color of the line, and then people
> would want legends to be automatically updated to reflect the new number of
> lines as well...
>
> I suggest trying again but keeping the number of columns the same in y. If
> need be, set the extra columns to NaN.
>
> You might also be interested in the linkdata() function, which effectively
> does refreshdata() automatically twice a second.


But an error message is thrown without changing the column size;
In this example I simply refreshdata without changing the data and an error is thrown.

X = 1:100;
Y = repmat(X,3,1);
h = plot(X,Y);
set(h,'YDataSource','Y'); set(h,'XDataSource','X')
refreshdata(h);
??? Error using ==> refreshdata at 58
Could not refresh YData from 'Y'.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.