How can I export data to excel from a GUI (created using GUIDE) using a push button
4 次查看(过去 30 天)
显示 更早的评论
I use the pushbutton to collect the data entered in each element of the GUI. I want to export the data to excel when i press the pushbutton
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hCheckboxes= [handles.checkbox19 ; handles.checkbox20 ; handles.checkbox21 ;handles.checkbox22;...
handles.checkbox23 ; handles.checkbox24 ];
checkboxValues = get(hCheckboxes, 'Value')
cough = get(handles.chCough, 'Value');
dry_cough = get(handles.chDryCough, 'Value');
head_ache = get(handles.chHeadache, 'Value');
sore_throat = get(handles.chSoreThroat, 'Value');
chill = get(handles.chCFever, 'Value');
mild_fever = get(handles.chFever, 'Value');
severe_fever = get(handles.chSFever, 'Value');
loss_smelltaste = get(handles.chLST, 'Value');
shrotness_breath = get(handles.chShBreath, 'Value');
muscular_ache = get(handles.chMuscular, 'Value');
others = get(handles.chOthers, 'Value');
city = get(handles.chCity, 'String
name = get(handles.edit2, 'String')
lastname = get(handles.edit7, 'String');
age = get(handles.edit3, 'String')
info_adicional = get(handles.edit5, 'String');
4 个评论
Rik
2020-5-17
Sure, although I would first check what syntax xlswrite needs. Then you can tailor the way you put it into an array to that.
回答(1 个)
Jyotsna Talluri
2020-5-19
Create a cell array of all the variables and export the cell array to excel file which is created in the same directory using xlswrite.
arr = {cough,dry_cough,head_ache,sore_throat,chill,mild_fever,severe_fever,...};
xlswrite('new.xlsx',arr);
Refer to the below link for more inormation
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!