Plotting simple function with App Designer
古いコメントを表示
Hello! I'm a beginner and I was wondering how can I build a GUI where I can insert a simple function and then I can plot it.
My final goal in one month will be to create a GUI that represents a Fourier transrom and how it changes when I change the angle offset, amplitude and so on.
any suggestions/tutorial?
Thank you
1 件のコメント
Agnish Dutta
2019 年 3 月 18 日
You can use MATLAB appdesigner to build GUIs.
The following page will give you an overview of the different components of appdesigner and their properties:
https://www.mathworks.com/help/matlab/creating_guis/choose-components-for-your-app-designer-app.html
In the appdesigner window, components can be dragged and placed in the main panel (which is a UI Figure object).
Next, you'll need to know how to manipulate the different objects and their properties using Callbacks. Callbacks are basically functions that are executed when certain event/s are triggered such as a button being pushed or a slider being moved. The following explains the same in detail:
Coming to the specific question which is about creating a GUi that plots a function, the following code may be used:
syms x; % Create a symbolic variable 'x'.
y = sin(x); % Create another variable 'y = sin(x)'.
fig1 = uifigure; % Create a uifigure object.
ax1 = uiaxes(fig1); % Create a uiaxes object with fig1 as its parent.
fplot(ax1, x, y); % Plot x vs y on the uiaxes object.
This will generate the plot on a GUI programmatically. The same can be done via appdesigner. You'll need a means to import data into your app though. I suggest using the uigetfile function. It return the file and it's path, that can be selected from a dialogue box.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!