Create a excel file (named as Input) in Matlab App designer and write variables in it.
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ajiket Patil
am 23 Feb. 2021
Kommentiert: Ajiket Patil
am 20 Mai 2021
Respected All,
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/528589/image.jpeg)
% Value changed function: NameEditField
function NameEditFieldValueChanged(app, event)
value = app.NameEditField.Value;
end
% 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
end
The above is neither creating a file in the folder nor displaying any error.
Thanking You.
Ajiket
0 Kommentare
Akzeptierte Antwort
Jemima Pulipati
am 26 Feb. 2021
Hello,
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.
3 Kommentare
Nestor Flores
am 8 Mai 2021
I'm getting crazy with a problema related to this. I cannot either create an excel file to save some data generated inside my program. And sometimes the program says that doesn't recognize some variable... is it necessary to declare every single variable as global on my program?
This is what I am doing, with those values on editfield I make calculus (trying to) use an empty folder inside.
The system doesn't save data on the excel file but it plot the graphs and they are right.
I used the instructions on the answers but nothing...
Please, what can I do?
Thank you
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/611380/image.jpeg)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!