Saving data in a GUI callback function
Mostra commenti meno recenti
I don't fully understand how to save data acquired through a GUI callback function, so I can use in another callback function. I want to save some variables in one function, everytime it is run, and then when another button is pushed all these data are written to an Excel file. I've tried the guidata function, but I don't really understand how to use hObject or handles. I've also found other functions for this, but it's unclear to me how to use them.
function SnapshotButtonPushed(app, event)
ind = app.SamplenumberEditField.Value;
%% Make picture
im = f_camera();
%% Detection
amount = f_detect
%% Save endtime and concentration to excel file
table_amount{ind} = amount;
table_conc{ind} = concentration;
table_endtimes{ind} = datestr(now,'HH:MM:SS');
hObject= %?
guidata(hObject,struct(ind, table_amount, ind, table_conc, ind,table_endtimes)); %Is this correct?
function ButtonPushed2(app, event)
ind = app.SamplenumberEditField.Value;
table_sample{ind} = ind;
table_name{ind} = 'name';
filename = 'Format.xlsx';
xlswrite('Format.xlsx',table_name,'Sheet1','A2')
xlswrite('Format.xlsx',table_sample,'Sheet1','B2')
xlswrite('Format.xlsx',table_endtimes,'Sheet1','G2')
xlswrite('Format.xlsx',table_amount,'Sheet1','H2')
xlswrite('Format',table_conc,'Sheet1','I2')
winopen('Format.xlsx')
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Develop Apps Using App Designer in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!