I have code that writes out data (string) to an excel spreadsheet. When the user clicks <Submit>, the information in the text area is output to an excel file ("ArticleRequest.xlsx"). This part works well in Matlab app designer 2019b version 5. When I run the app a second time, the data should go to the next row in excel but instead it overwrites the information in the first cell. How can I fix this? I have looked everywhere on this site, on Stack Overflow, in Matlab Help and no one seems to have a code that works in app designer. The code that works is below. The last 4 rows are directions to the user after the data is output to the excel file. Any helpful suggestions are appreciated.
% Button pushed function: SubmitButton
function SubmitButtonPushed(app, event) filename = 'ArticleRequest.xlsx'; %file
M = {app.TextArea_Email.Value}; %data
writecell(M,filename,'Sheet','EmailReq'); %write data to cell in table
app.TextArea_Email.Value = 'Press <Next> to continue.'; app.SubmitButton.Visible = 'off'; uiconfirm(app.UIFigure,{'The file has been created.','Click OK'},'File Creation Confirmation','Icon','Success'); app.NextButton_Email.Enable = 'on'; end
Best Answer