Path: news.mathworks.com!not-for-mail
From: "Eddie " <eddie@webassign.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: getimage (IPT) weirdness
Date: Tue, 14 Oct 2008 18:52:01 +0000 (UTC)
Organization: WebAssign
Lines: 22
Message-ID: <gd2poh$t8n$1@fred.mathworks.com>
References: <gd2nue$2ul$1@fred.mathworks.com> <ew5Jk.11$tV.9@newsfe08.iad>
Reply-To: "Eddie " <eddie@webassign.net>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1224010321 29975 172.30.248.37 (14 Oct 2008 18:52:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 14 Oct 2008 18:52:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1259345
Xref: news.mathworks.com comp.soft-sys.matlab:495150


Walter Roberson <roberson@hushmail.com> wrote in message <ew5Jk.11$tV.9@newsfe08.iad>...
> Eddie wrote:
> > So, my understanding of the documentation of the getimage function from the Image Processing
> > Toolbox is that if I say:
> 
> > xp = linspace(-10,10,350);
> > fig = figure;
> > plot(xp,xp.^2);
> > A = getimage(fig);
>  
> > A should now be a matrix that contains the data relating to the pixels of the figure with
> > the plotted parbola.  However, when I try this, A is empty.
> > What I am doing wrong?
> 
> Look at the documentation again. getimage() returns whatever is in the first CData array
> that is found under the given handle. Objects of type image have CData arrays (as well as
> some other kinds of objects such as objects of type patch), but plot() creates
> objects of time axes and lineseries, neither of which have CData arrays.
> 
> Perhaps what you wanted to look at was getframe().

OK, you're right.  I saw that a figure was a valid argument to the function, and assumed magic would happen.  getframe() won't work for my purposes though because I need to suppress the actual display of the plot, and getframe() requires the figure to be visible.  Other suggestions?