Reputation: 101
I'm beginner and trying to use polarplot
and hold on/off
in MATLAB App Designer. Now to use this in app designer, we need to create the polar axes by calling the polaraxes
function in the app designer panel container.
I tried this which is working fine without any error:
pax = polaraxes(app.Panel);
polarplot(pax,th1,r1,'red')
hold(app.UIFigure.CurrentAxes,'on'); % warning
polarplot(pax,th2,r2,'green')
hold(app.UIFigure.CurrentAxes,'off'); % warning
But due to app coding alerts, I'm getting the warning "Specify a UIAxes handle as first argument" for the hold line. How do I resolve this warning ? Is this the correct way to use hold on/off
for the panel container?
Upvotes: 1
Views: 1696
Reputation: 1346
A similar question was answered over at MATLAB Answers.
This is just a warning from the code analyzer, and not necessarily something specifically wrong with your code. You get this warning because when using App Designer it expects that you're using a UIAxes
rather than a standard Axes
object. You really can just ignore this warning.
Upvotes: 1
Reputation: 5672
I've not used appdesigner much, but I suspect its because the CurrentAxes variable is empty that you get a warning, so you could try to specify the axes to hold:
pax = polaraxes(app.Panel);
polarplot(pax,th,r1,'red')
hold(pax,'on');
polarplot(pax,r2,'green')
hold(pax,'off');
Or this might work (untested, and not recommended if it does, its always advisable to pass the actual axes handle that you want to hold rather than the one Matlab thinks is active)
pax = polaraxes(app.Panel);
polarplot(pax,th,r1,'red')
drawnow()
hold(app.UIFigure.CurrentAxes,'on'); % warning
polarplot(pax,r2,'green')
hold(app.UIFigure.CurrentAxes,'off'); % warning
Upvotes: 0