How to plott graph in Appdesigner from MATLAB
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I have created a Function in MATLAB, That plots 3 graph (which i have mentioned) in the Function. Now, in the app desginer, i want to to call that function or i have to do the same plotting in the axes, after trying alot, i am unable to solve it.
This is the Function that i Creates in the MATLAB :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/823380/image.png)
Now, i want to plott this graphs in appdesiner but, it is showing me in another window, when i click on run and not in the Axes.
This are the changes that i made in Code view :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/823385/image.png)
Can anyone please help me with this thing?
0 个评论
采纳的回答
Julius Schroers
2021-12-4
First you need to create an Axes, I don't know if you have already done that. The important thing is that you also have to specify where you want to plot in the AppDesigner. Also the commands for grid, hold and so on are different in AppDesigner, because you have to define the target.
I have adapted a few things as an example:
function Plot_graph(app)
fplot(app.UIAxes,@(x) sin(x),[-2 2],"LineWidth",2)
hold(app.UIAxes,"on")
fplot(app.UIAxes,@(x) cos(x),[-2 2],"--or")
grid(app.UIAxes,"off")
hold(app.UIAxes,"off")
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!