Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Clearing drawn lines from a figure window
Date: Mon, 9 Mar 2009 19:49:01 +0000 (UTC)
Organization: Atlantic Inertial Systems
Lines: 15
Message-ID: <gp3rrd$2ka$1@fred.mathworks.com>
References: <gp3q5h$8te$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1236628141 2698 172.30.248.37 (9 Mar 2009 19:49:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Mar 2009 19:49:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1405925
Xref: news.mathworks.com comp.soft-sys.matlab:523579


"Patrick " <praphael@bcm.tmc.edu> wrote in message <gp3q5h$8te$1@fred.mathworks.com>...
> Is there any way to clear lines drawn with the line() command from a figure window?  clear() doesn't seem to work.  Clearing the entire figure resets the axes to defaults, and its an image window where you don't want axes.  I'm not sure how to redraw the image though if thats the only way to do it I will need a ay to redraw it quickly. 

one way
hLine = line([1 1], [0 0]);  % draw line

delete(hLine)  % delete line

If you're going to reuse the line later this may be preferable
set(hline, 'XData', [], 'YData', [])

If you need to update the figure
drawnow()

~Adam