graphing in a guide

2 ビュー (過去 30 日間)
Perez
Perez 2021 年 4 月 23 日
コメント済み: Rik 2021 年 5 月 4 日
Hello, I am going to make a guide, I have a graph and I would like that the graph reflect these points (3,10) (6,15) (9,25) how would the code be?
  1 件のコメント
Rik
Rik 2021 年 4 月 24 日
This is a very basic question. Did you do a basic Matlab tutorial? Matlab is a very powerful tool, it is worth the investment to properly learn it, otherwise this question can be done with excel.
You are looking for the plot function. You can use the axis function to change the x and y limits.

サインインしてコメントする。

回答 (1 件)

Pratheek Punchathody
Pratheek Punchathody 2021 年 4 月 26 日
編集済み: Pratheek Punchathody 2021 年 4 月 26 日
Important: The GUIDE environment will be removed in a future release. After GUIDE is removed, existing GUIDE apps will continue to run in MATLAB® but they will not be editable in GUIDE. To create new apps interactively, Develop Apps Using App Designer instead.
You can follow the steps to get through your query,
Step 1: Create a GUIDE using the following command in the Command Window
guide;
Step 2: Draw the axes on the canvas as shown below. Double click on the axes to access the code in MATLAB
Step 3: Add the code to the following function
function varargout = guidetest_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
x=[3 6 9];
y=[10 15 25];
plot(x,y,'*','color','r');
% Get default command line output from handles structure
varargout{1} = handles.output;
Below figure is the output when you RUN the code/GUIDE:
Refer to the documentation on Create a Simple App Using GUIDE and "plot()" for further reference.
Hope this helps..
  3 件のコメント
Perez
Perez 2021 年 5 月 4 日
@Pratheek Punchathody Thank you, it was what I needed! Now I have to add a pop up menu to the graph where I can change the colors of the graph, how would the code be?
Rik
Rik 2021 年 5 月 4 日
For advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by