How to establish the handle value of a personalized plot function?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2021-3-13
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'));
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!