In App designer how to plot multiple plot on a same figure if one variable value coming from a function and also its value changes with output of function?

15 views (last 30 days)
Hello, i m writing a code in Matlab App Designer if i ask in simple words lets say a = 0:0.1:2*pi;
and i want to plot it with row vector 'b' value lets say b = 0:1:90; , so its simple to use plot(a,b;)
but if value of 'b' variable is row vector coming from the output off a function then lets say i use b = function(name) then plot (a,b) this do well...
problem comes when some time my function once generate values for variable 'b' and some time twice, in case of twice it overwrites variable 'b' value.
How can i use Both Values for Variable 'b' for plot with Variable 'a' on same figure.
kindly guide how can i write proper code. Thanks

Accepted Answer

Mario Malic
Mario Malic on 1 Oct 2020
On the UIAxes, check the right hand side, Multiple plots - Next Plot - Add. If this doesn't work then write more on this: problem comes when some time my function once generate values for variable 'b' and some time twice, in case of twice it overwrites variable 'b' value.
  2 Comments
Mario Malic
Mario Malic on 1 Oct 2020
Dear Sadiq, there are no requests here, just questions, answers and comments.
What I have written, actually works, so I am repeating it here. Multiple plots - Next Plot - Add
% Programmatically, in startupFcn
hold (app.PulsePlotUIAxes, 'on')
You will also need to add the button with the callback to clear the axes
% Button pushed function: Button
function ButtonPushed(app, event)
cla(app.PulsePlotUIAxes)
end

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D 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!