How do I export data to a file?

14 views (last 30 days)
Daniel
Daniel on 21 Apr 2025
Commented: Star Strider on 21 Apr 2025
Hello,
I'm getting out of memory errors when trying to copy a large dataset (9003x9003 double) using Ctrl+C with the intention of pasting it to Excel, even though I've increased the Java Heap memory to the maximum. The error window suggests copying portions (I'm not doing that with such a large dataset) or exporting the dataset to a file - how do I do that please? I would expect such an option in its right-click menu but it's not there - i.e. let's make the paid software as complicated as we can :)))
xlswrite leaves me with empty files, csvwrite with corrupt files - even though it's plain data
Thank you

Accepted Answer

Star Strider
Star Strider on 21 Apr 2025
If the data are in a matrix that are assigned to one or more variables, first use the save function to save t he variables to a .mat file. That will guarantee that you have a backup for it.
Second, use the writematrix (or writetable if it is already a table) functions to write it to a .txt of .xlsx file. You might be able to do that from the Command Wiindow. If not, you can load the .mat file and then write it.
  2 Comments
Daniel
Daniel on 21 Apr 2025
Edited: Daniel on 21 Apr 2025
Thank you ^^
Why isn't there a simple Export button though? 🥺
Star Strider
Star Strider on 21 Apr 2025
As always, my pleasure!
That there isn’t an Export button is a MathWorks design decision. I suggest that you Contact Support and suggest that option be added. I believe it would be useful.
Include the URL of this thread in your note to MathWorks so that you don’t have to repeat everything you wrote here.

Sign in to comment.

More Answers (0)

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!