Saving all variables in a single file (ideally an excel file)
8 views (last 30 days)
Show older comments
Hi, I was just wondering if there was a way to save all variables in a workspace to a single Excel file? Ideally each variable would be saved as a single tab, but could also simply be added to the next column in a single worksheet tab.
If they can't be saved as an Excel sheet, then what are the other options? Is there another way to save an entire workspace full of variables to a single file?
0 Comments
Answers (1)
Dyuman Joshi
on 22 Feb 2024
One option is to save all the variables in a workspace to a .mat file.
On the Home tab, in the Variable section, click Save Workspace.
Reference - https://in.mathworks.com/help/matlab/matlab_env/save-load-and-delete-workspace-variables.html
Saving the full workspace to an excel file would be a tedious task (especially if you have a lot of variables), as you will have to manually put all the variables in a cell array/table (if they are heterogenous or non-uniform), or concatenate them into a numerical array (if they are compatible for concatenation), and then use any of writecell, writetable or writematrix accordingly.
3 Comments
Walter Roberson
on 22 Feb 2024
save(FILENAME)
saves the entire current workspace as a .MAT file.
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!