How to preserve data for a specified variable in matlab

Source: Internet
Author: User

When using MATLAB, you typically save the results of the calculation to a mat file. The command used is: Save filename

But when saved with the above command, the other variables in the calculation process are saved together. This coarse preservation has the following drawbacks:

(1) The unwanted data is saved to the mat file, which causes the mat file to be too large;

(2) The next time you load the mat file, it will display other unwanted data that consumes system memory.

Therefore, when you save the data, you should save the useful data variables.

Processing method:

(1) Delete the variable first, then save

For example, the variable a,b,c,d,e,f,g, you need to retain the value of a,e,f, you can use the command: Clear b c D; Then save filename

"Applicable" in the case of a few redundant variables, there are many variables saved.

(2) When saving, specify the saved variable

For example, variable a,b,c,d,...... A few hundred variables, you need to retain the value of a, you can use the command: Save filename A

The "Where applicable" redundancy variable is very numerous, saving fewer variables.

In addition , if you change a single, save the time, the back to add-append, so that will not overwrite the other. 

How to preserve data for a specified variable in matlab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.