How to access the data and passing it around when using GUI?
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am new to matlab and trying to write a code for easier data filter for my colleague. By the way,i am using matlab R2011a.
i first wrote several functions to just import from excel file and did some data filter to exclude the unwanted infomations. and i had wrote a main function try to automate all the process.
function fgAnalysisMain (Filename,state)
RawData = importfile(Filename);
Data = fgDataFiltering(RawData,state);
end
The importfile function is matlab generated code. The fgDataFiltering function will take the imported data and filter the infomations through the conditioning (1,9) matrix called state.
when i run the main function in command window. the result Data will be a structure with maximum 9 field names, and each field will have 1 column of numerical data.
when i was working with command window, these functions work perfectly fine, but when i call this main function in the GUI code(shown below)
function btnAnalysis_Callback(hObject, eventdata, handles)
% hObject handle to btnAnalysis (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
states = zeros(1,9);
cbSOC_Callback(handles.cbSOC,eventdata,handles);
cbSOH_Callback(handles.cbSOH,eventdata,handles);
cbESR_Callback(handles.cbESR,eventdata,handles);
cbVoltage_Callback(handles.cbVoltage,eventdata,handles);
cbCurrent_Callback(handles.cbCurrent,eventdata,handles);
cbbms_Callback(handles.cbbms,eventdata,handles);
cbTemperature_Callback(handles.cbTemperature,eventdata,handles);
cbTimeMinutes_Callback(handles.cbTimeMinutes,eventdata,handles);
cbTimeSeconds_Callback(handles.cbTimeSeconds,eventdata,handles);
Filename = get(handles.file_address_output,'String');
fgAnalysisMain(Filename,states);
this Analysis button will check 9 checkbox status and update the state matrix introduced before and finally passing those parameters to the fgAnalysisMain function i wrote. but when i try the GUI, nothing showed up in workspace except the raw data from executing the importfile function.
I didn't setup any global variable in any functions and i tried to save output from fgAnalysisMain to variable named 'Data',and use assignin('base','Result',Data), the result Data is empty.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!