How to load a .mat file with a push button, calculate the data using my own functions and plot a figure in a GUI made in GUIDE.
5 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I am very new at this with making GUIs. I have a .mat file (consisting of 4 separate variables) that I am uploading using a push button in a GUI and using the code:
function load_file_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to load_file_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
filename = uigetfile('*.mat');
handles.data = load(filename);
I now want to change the data in the .mat file with a few functions I have written before as .m files (which I of course can copy into the GUI .m file) and plot a figure using a different pushbutton. Can anyone please help me?
Thanks in advance!
3 个评论
采纳的回答
Geoff Hayes
2016-7-7
Andreas - yes, if your mat file consists of the variables p, t, x, and y, then if your first pushbutton callback does
function load_file_pushbutton_Callback(hObject, eventdata, handles)
filename = uigetfile('*.mat');
handles.data = load(filename);
guidata(hObject,handles);
then you will be able to access these variables in any other callback through (for example)
handles.data.x
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
