Continues update of figure with new data entered mannually from GUI

1 回表示 (過去 30 日間)
SatyaPrakash Gupta
SatyaPrakash Gupta 2019 年 11 月 26 日
編集済み: SatyaPrakash Gupta 2019 年 11 月 26 日
Hi,
I am beginner to MatLab and have one question as below:
Question :
  1. i have 2 matlab script file , one has GUI and the other has normal function definition for plotting the figure. when my GUI opens, in the edit text box, i enter the value and my function works accordingly i.e figure get plotted.
Problem : everytime when i update the text box, each time new figure gets open and there are nearly 8 figures, how can i update the figures when new text data is provided ?
Please note : i use scatter, gscatter, dbscan etc for each figure to get plotted
Your feedback will help me out to procced with my current activity.
thank you and waiting for your feedback.
Regards,
Satya

採用された回答

Jakob B. Nielsen
Jakob B. Nielsen 2019 年 11 月 26 日
Welcome to the wonderous world of GUIs :)
You can label your figures. Normalized units can be changed to pixels, inches, centimeters etc. and you change the backmost numbers accordingly.
Then, when you plot something in your function, state which figure to update by calling the figure label. You can add as many figures into the same GUI as you want, and as long as you give them different "names", you can easily specify when to update what.
MYGUI=figure('toolbar','figure','MenuBar','none','Name','Sample GUI','NumberTitle','off','Color',[0.85 0.85 0.85],'Units', 'points','Position',[10 , 0, 1135 , 530 ]);
%This labels your GUI, and its name is now "MYGUI".
%That way, you define the figure "MyFigure" to belong to the "MYGUI" parent.
MyFigure = axes('Parent', MYGUI,'Units', 'normalized','HandleVisibility','callback','Position',[0.05,0.50,0.42,0.10]);
%And now, make a plot, add a legend, and label the y-axis on the figure you just labelled "MyFigure".
plot(MyFigure,x_data1,y_data1,'r-',x_data2,y_data2,'b-');
lgnd1=legend(MyFigure,'Sample data 1','Sample data 2','Location','SouthWest');
ylabel(MyFigure,'This label goes on "MyFigure"','FontSize',11,'Interpreter','latex');
  1 件のコメント
SatyaPrakash Gupta
SatyaPrakash Gupta 2019 年 11 月 26 日
編集済み: SatyaPrakash Gupta 2019 年 11 月 26 日
Hi Jakob,
I have 2-files, file_gui.m and file_function.m
  1. MYGUI should be placed on which file ?
  2. myFigure should be placed on which file ?
  3. the 3rd statment should be placed on which file ?
I am sorry to ask this question as i am not yet able to build it.
Please note : i am using scatter function.
thank you.
Regards,
Saty

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by