Create a excel file (named as Input) in Matlab App designer and write variables in it.
60 views (last 30 days)
I want to create an excel file with "named as the input", and pass on variables into it from the app designer.
Aim is to create a file named "Test.xlsx" in the folder "Excel_Folder" and write variables "variable1", and "variable2" into the excel file after pressing the "Export data" pushbutton.
I have tried the following:
% Value changed function: NameEditField
function NameEditFieldValueChanged(app, event)
value = app.NameEditField.Value;
% Button pushed function: ExportdataButton
function ExportdataButtonPushed(app, event)
folder = app.Excel_Folder; % create a new folder with name Excel_Folder
filename = app.NameEditField.Value; % name of the file
writetable(fullfile(folder, filename), app.variable1, app.variable2); % write variables 1 and 2 into in the file
The above is neither creating a file in the folder nor displaying any error.
Jemima Pulipati on 26 Feb 2021
From my understanding, you want to create an excel file and write some data into it.
The writetable() function expects the first argument to be a table containing some data followed by the filename. You may consider modifying the function call in your code according to the syntax.