A new figure is coming out while plotting inside a for loop in App designer.
Show older comments
Trying to plot a 3D figure in the appdesiner but every time when is run the application it is opening a new figure window. I am not getting how to resolve this issue. Tried solutions given in some of the central questions but didn't worked. The part of the code is as
len_sum=sum(al);
xmin=-1.5*len_sum;
xmax=1.5*len_sum;
ymin=-1.5*len_sum;
ymax=1.5*len_sum;
zmin=-1.5*len_sum;
zmax=1.5*len_sum;
for i=1:length(app.T)
app.q=app.Y(i,1:n);
app.dq=app.Y(i,n+1:2*n)';
[so, sc, vc, tt, st] = for_kine(app,app.q, app.dq, n, alp, a, b, th, bt, r, dx, dy, dz);
B1X=[so(1,1), st(1,1)];
B1Y=[so(2,1), st(2,1)];
B1Z=[so(3,1), st(3,1)];
B2X=[so(1,2), st(1,2)];
B2Y=[so(2,2), st(2,2)];
B2Z=[so(3,2), st(3,2)];
app.tim=app.T(i);
app.tim=num2str(app.tim);
plot3(app.UIAxes_animation,B1X,B1Y,B1Z,B2X,B2Y,B2Z,'linewidth',2);
axis(app.UIAxes_animation,[xmin xmax ymin ymax zmin zmax]);
xlabel(app.UIAxes_animation,'X (m)','fontweight','normal','fontsize',10);
ylabel(app.UIAxes_animation,'Y (m)','fontweight','normal','fontsize',10);
zlabel(app.UIAxes_animation,'Z (m)','fontweight','normal','fontsize',10);
title(app.UIAxes_animation,['Current time t=',app.tim],'fontweight','normal','fontsize',10);
grid on;
drawnow;
end
2 Comments
Mario Malic
on 7 Nov 2021
Open the application in the debugging mode, and run the code step by step to figure out where the figure is being created.
It's impossible to figure out anything from this code.
Saurabh Chaudhary
on 7 Nov 2021
Accepted Answer
More Answers (0)
Categories
Find more on Develop Apps Using App Designer 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!