Graphics Programs Reference
In-Depth Information
We can now issue the correct text command:
Let us write an m-file to do this automatically. We'll call it oops . When
we call oops without any argument, it should delete the last object
drawn in the current axes. When called with an integer argument, n ,
oops should delete the last n objects drawn in the current axes. The
following m-file is a possible solution. (The function nargin returns the
number of arguments with which a function was called.)
function oops(N)
% OOPS Delete the last object plotted on the axes.
% Repeating "oops" erases farther back in time.
% OOPS does not work for title and labels; to
% erase these, use "title('')" or "xlabel('')"
if nargin = =0N=1;end
h = get(gca,'children');
Let us see if oops works:
hold on
Nowwedoan oops to get rid of the shallow parabola,
Now plot the shallow one again with a different line style:
Search WWH ::

Custom Search