how to plot in UIAxes in app designer

i have written codes for a plot in .m file now i wanna plot the same thing in a interface made by using appdesigner.
this is my plotCapture1.PNG
i want to plot it here
Capture3.PNG

 Accepted Answer

Ajay Kumar
Ajay Kumar on 25 Oct 2019
Edited: Ajay Kumar on 25 Oct 2019
You can give axes handle in the plot.
for example, if you used
plot(x,y);
now, use
plot(app.UIAxes,x,y);
and ofcourse, the testtesttest function should have the handles of app.

10 Comments

Ni2
Ni2 on 25 Oct 2019
Edited: Ni2 on 25 Oct 2019
What is handles of app??
I dnt think i have them
My problem is my plot comes in 2D
View[1 1 1] is not working And same window is poping two times in one run. One with blank plot and one with 2D plot.
Are you calling the testtesttest.m from app designer?
No i m not calling testesttest.m from app designer.
I an writing the testtesttest.m codes into the app designer
Please check my new post.
Hi Ajay, I am trying to display an image in the Axes with 'imshow(I)' command where I contains my image.
Can you kindly tell me the command to use. I am using Matlab 2019.
it works when I use plot(app.UIAxes,x,y) but I dont understand how to use 'imshow'.
I have watched several videos but nothing helped.
Waiting for your reply.
Thanks
Try this
imshow(I,'Parent',app.UIAxes);
Thank you very much, it worked
Ni2, you can find the handle of the axes in the Component Browser in App Designer. By default, the first one will be named "app.UIAxes" and subsequent ones will be "app.UIAxes_2" and so on. You can change the handle / name of the axes by double-clicking the name in the Component Browswer and entering a new name.
Hi @Ajay Kumar. I am trying to display a figure from a .m file in the app (3D plot) using imshow(I,'Parent',app.UIAxes);
But I get an error of undefined variable of function for I when I try to run the app. Can you please suggest what can be done !
code in xyz.m file --> plotReadData=figure;
code in .mlapp file --> run xyz.m;
imshow(plotReadData, 'Parent', app.UIAxes);
Based on the experience I've tried and succeeded, try typing this:
imshow(picture.jpg,'Parent',app.UIaxes)
For the picture format, it can be other than .jpg., and pay attention to the field name of the UI Axes used.
Hope it helps ^_^
How do you use fnplt for uiaxes?
plot(app.uiaxes,x,y) works but fnplt(app.uiaxes,cscvn(points)) does not. Does anyone have any suggestion?

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

Ni2
on 25 Oct 2019

Commented:

on 9 Jun 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!