필터 지우기
필터 지우기

How can I get an Excel with differentes rows each time I write a name in a GUI and I press the buttom "Save" to save the information in a row of an Excel file?

조회 수: 2 (최근 30일)
I want to write information of patients (name, surname, telephone, etc) and I want to safe that information on an Excel each time I press the buttom Save in a GUI. How can I do that?

답변 (1개)

ES
ES 2017년 6월 26일
in the callback function of the save button, you will do an xlswrite.
Something like this:
function SaveButton_Callback(hObject, eventdata, handles)
persistent rowno;
sPatientName = get(handles.editbox1,'String');edit box with patient name
sPatientAge = num2str(get(handles.editbox2,'String'));edit box with patient age
...all other data you need
xlswrite('PatientData.xlsx', {sPatientName, sPatientAge}, 'Sheet', ['A',num2str(rowno)]);
rowno = rowno+1;
  댓글 수: 2
Collegue
Collegue 2017년 6월 26일
I HAVE THIS FUNCTION AND IT DOESN'T WORK. WHAT CAN I DO?
function Guardar_Callback(hObject, eventdata, handles)
global numero
% hObject handle to Guardar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
numero=0;
numero=numero+1;
persistent rowno;
data.nombre=get(handles.edit1,'String');
data.apellido=get(handles.edit2,'String');
data.registro=get(handles.edit3,'String');
data.fecha=get(handles.dateEditBoxHandle,'String');
xlswrite('D:\interfaz\DATOS_PACIENTES.xlsx',{'Nº','Nombre','Apellido','Registro','Fecha'} ,'Hoja1','A1');
xlswrite('D:\interfaz\DATOS_PACIENTES.xlsx', {numero,data.nombre,data.apellido,data.registro,data.fecha}, 'Hoja1', ['A',num2str(rowno)]); rowno = rowno+1;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by