Get figure handle from different mfile and plot in GUI
2 次查看(过去 30 天)
显示 更早的评论
I am tasked to design a GUI and I need to use variables and plots from a different mfile which I created earlier. I'm pretty confident about getting variables from the processing mfile but I'm not sure how to get the plots/figures.
So basically my question is whether I can get() a figure from my mfile and then set() an axes to that figure inside my GUI.
Note: The reason I am doing this is because I want to keep the processing of data separate from the GUI mfile. I could just dump all the processing in the callback of my process button but that's not what i want. I would also appreciate good coding practices for my case since I have never worked with GUI's before (only scripting with PHP and MATLAB)
Note2 (rundown of what has to be done): In the GUI we basically are supposed to load 2 files, we then press the "process" button and then 4 plots have to appear. All the processing code already exists in a previously written mfile (by me).
Thanks! :) ============================================ EDIT:
So i managed to get this working by passing each plot to a variable using p=plot() and then passing that variable to my handle.
However, in my callback function, I am not sure how to set those axes to the right objects. I tried a lot of different things and they always end up in the wrong places or with just don't appear at all.. Current setup:
input.fullpath_wind = get(handles.edit_wind, 'String');
input.fullpath_gps = get(handles.edit_gps, 'String');
axes(handles.axes_worldmap)
setappdata(0,'input',input)
run opgave3
getappdata(0,'output')
set(output.worldmap,handles.axes_worldmap)
How would I add another axes?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!