Continues update of figure with new data entered mannually from GUI
1 view (last 30 days)
Show older comments
SatyaPrakash Gupta
on 26 Nov 2019
Edited: SatyaPrakash Gupta
on 26 Nov 2019
Hi,
I am beginner to MatLab and have one question as below:
Question :
- 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
0 Comments
Accepted Answer
Jakob B. Nielsen
on 26 Nov 2019
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 Comment
More Answers (0)
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!