How do you plot a point in a GUI graph

I have a Gui that i need to plot a random point in the axes but I dont know how. This is what I have

回答 (1 件)

Image Analyst
Image Analyst 2022 年 11 月 10 日

0 投票

Did you try the plot function:
plot(x, y, 'b.', 'MarkerSize', 20);
grid on;

6 件のコメント

Amanda
Amanda 2022 年 11 月 10 日
Yes, every time I do this it erases the buttons at the bottom and the random point isnt plotted in the axes
Image Analyst
Image Analyst 2022 年 11 月 10 日
I can't run an image. I need code. Attach your .mlapp file (if using App Designer) or .m and .fig file (if using GUIDE).
Amanda
Amanda 2022 年 11 月 10 日
f= figure;
ax= axes('Parent',f,'Position',[0.05, 0.25, 0.9, 0.7]);
hold on;
my_button = uicontrol('style','pushbutton');
set(my_button, 'units', 'normalized', 'position', [0.05,0.05,0.3,0.15])
set(my_button, 'string','Add Point')
my_second_button = uicontrol('style','pushbutton');
set(my_second_button, 'units', 'normalized', 'position', [0.35,0.05,0.3,0.15])
set(my_second_button, 'string', 'Clear')
my_third_button = uicontrol('style', 'pushbutton');
set(my_third_button, 'units', 'normalized','position', [0.65,0.05,0.3,0.15])
set(my_third_button, 'string', 'Randomize')
Image Analyst
Image Analyst 2022 年 11 月 10 日
編集済み: Image Analyst 2022 年 11 月 10 日
No, why are you punishing yourself? That's so tedious. You didn't even specify any callback function. Just use AppDesigner like most everyone else.
Amanda
Amanda 2022 年 11 月 11 日
its how im suppose to do it for an assignment, sorry?
Image Analyst
Image Analyst 2022 年 11 月 11 日
What a cruel professor. Then you need to define a callback function, and then tell uicontrol() what the callback function's name is.

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

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

質問済み:

2022 年 11 月 10 日

コメント済み:

2022 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by