Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Plot to a figure from a function
Date: Sat, 29 Sep 2007 17:03:42 -0400
Organization: The MathWorks, Inc.
Lines: 51
Message-ID: <fdmeji$snj$1@fred.mathworks.com>
References: <fdmcgt$1cj$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: rossonr.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1191099826 29427 144.212.206.73 (29 Sep 2007 21:03:46 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 29 Sep 2007 21:03:46 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Xref: news.mathworks.com comp.soft-sys.matlab:430703



Hi David,

The plot function expects an axes handle, not a figure handle.  Try the 
following:

   f = figure;
   a = axes;

   MyFunction(a, ...);

Inside the function:

    plot(a, ... );

I hope that helps.

Thanks.

Rick




"David Doria" <daviddoria@gmail.com> wrote in message 
news:fdmcgt$1cj$1@fred.mathworks.com...
> in my script i do
>
> h = figure;
>
> then i have a loop which calls a function 'MyFunction' with
>
> MyFunction(h(1), more_params)
>
> the function definition for MyFunction is
>
> function MyFunction(h, more_params)
>
> inside MyFunction, i do
>
> plot(h, ones(10))
>
> and nothing(!) happens until after the program finishes
> running, at which point i get a blank axis displayed
>
> does it not work like this?
>
> Thanks,
>
> David