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.
Subject: Clearing drawn lines from a figure window
On Mon, 09 Mar 2009 15:20:17 -0400, Patrick <praphael@bcm.tmc.edu> wrote:
> 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.
help line
...
LINE returns a column vector of handles to LINE objects,
one handle per line. LINEs are children of AXES objects.
...
You can delete this handle to remove the line from the figure.
lh=line(<...>)
%use the below when you want to delete the line
delete(lh)
If you cant/dont want to do the above, you could use the FINDOBJ to search
for the line object (tricky if you have multiple lines). This is just to
let you know of an alternative.. I would recommend using the first
approach.
Subject: Clearing drawn lines from a figure window
"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', [])
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.