Saving workspace via command

5 views (last 30 days)
Sam Hurrell
Sam Hurrell on 19 Oct 2021
Commented: Cris LaPierre on 20 Oct 2021
I have written code to produce 30 (approx) numeric matrices, all of which I wish to save to a given directory under a single .mat name. What code can be written within the script to save the entire workspace automatically?

Answers (2)

Cris LaPierre
Cris LaPierre on 19 Oct 2021
  1 Comment
Cris LaPierre
Cris LaPierre on 20 Oct 2021
To save the file to a specific folder (other than the current folder), Include the desired path in your filename. You can use fullfile for this if you find that easier.

Sign in to comment.


Walter Roberson
Walter Roberson on 19 Oct 2021
save('NameOfFileToSaveTo.mat')
  1 Comment
Sam Hurrell
Sam Hurrell on 20 Oct 2021
That saves the workspace to the current folder, how would I save it to a defined location?

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!