Saving data in a GUI callback function
古いコメントを表示
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')
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!