Continues update of figure with new data entered mannually from GUI
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!