How to establish the handle value of a personalized plot function?
1 view (last 30 days)
Show older comments
I need to develop a program that will:
(a) plot one set of data into a figure at a time,
(b) when the next set of data is plotted, the previous plot needs to be removed.
I definied my own functioned as below:
function plot1(a, b, c, d)
plot ...
plot ...
plot ...
.... % a total of about 50 plots
end
It works very well by calling the program as below:
plot1(a, b, c, d)
Here is the problem. Because I need to remove the previous plot, I'm trying to give the plot a handle, so that I can use delete(app.A) to remove the previous plot.
app.A = plot1(a, b, c, d)
Now Matlab is complaining:
Too many output arguments.
How do I rewrite my plot program so that it can be assigned with a handle like the normal Matlab function "plot".
Many thanks.
0 Comments
Accepted Answer
Walter Roberson
on 13 Mar 2021
function plots = plot1(a, b, c, d)
plots(1) = plot ...
plots(2) = plot ...
plots(3) = plot ...
.... % a total of about 50 plots
end
However, have you considered just using
cla(app.AppropriateAxesHandle);
or
delete(findobj(app.AppropriateAxesHandle, 'type', 'line'));
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!