How can I export data to excel from a GUI (created using GUIDE) using a push button
조회 수: 2 (최근 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!