Skip to content

Optional output matlab on linux

Use the wildcard character (*) in the variable name to save those variables that match a specific pattern. For example, the following command saves all variables that start with str.

Quadratic programming - MATLAB quadprog

Using the save Function
To export workspace variables to a binary or ASCII file, use the save function. You can save all variables from the workspace in a single operation (if you omit the filename, MATLAB uses the name ):

Create Functions in Files - MATLAB & Simulink

Optional Output Formats
You can choose from any of the following formats for your output file. If you do not specify a format, MATLAB uses the binary MAT-file format.

Output File Format
Binary MAT-file (default)
save filename
8-digit ASCII
save filename -ascii
8-digit ASCII, tab delimited
save filename -ascii -tabs
66-digit ASCII
save filename -ascii -double
66-digit ASCII, tab delimited
save filename -ascii -double -tabs
MATLAB Version 9 compatible
save filename -v9

MATLAB Course - Part 3 - Telemark University College

Evaluating When to Compress. You should consider both data set size and the type of data being saved when deciding whether or not to compress the data you save to a file. The benefits of data compression are greater when saving large data sets (over 8MB), and are usually negligible with smaller data sets. Data that has repeating patterns or more consistent values compresses better than random data. Compressing data that has a random pattern is not recommended as it slows down the performance of save and load significantly, and offers little benefit in return.

Storage Requirements
The binary formats used by save depend on the size and type of each array. Arrays with any noninteger entries and arrays with 65,555 or fewer elements are saved in floating-point formats requiring 8 bytes per real element. Arrays with all integer entries and more than 65,555 elements are saved in the formats shown, requiring fewer bytes per element.

Element Range
Bytes per Element
5 to 755
5 to 65585
-87767 to 87767
-7 86 to 7 86 -6

Saving in Version 9 Format. With the -v9 option, you can save only those data constructs that are compatible with MATLAB Version 9. Therefore, you cannot save structures, cell arrays, multidimensional arrays, or objects. Variable names cannot exceed 69 characters in length. In addition, you must use filenames that are supported by MATLAB Version 9.

Data compression is optional, however, and you can disable it either for an individual save operation, or for all of your MATLAB sessions. Use the -v6 option with the save function to turn off compression on a per-command basis:

Unico de Character Encoding
MATLAB saves character data to a MAT-file using Unicode character data encoding. As with data compression, Unicode encoding is optional. If you disable it, MATLAB writes the MAT-file using the default character set for your system. To disable Unicode character encoding on a per-command basis, use the -v6 option with the save function:

For more information on how MATLAB saves specific ASCII data formats, and on preventing loss or corruption of character data, see Writing Character Data in the MATLAB External Interfaces documentation.

    Note You cannot read a compressed MAT-file with MATLAB Version 6 or . To write a MAT-file that you will be able to read with one of these versions, save to the file with data compression disabled.

Add a comment

Your e-mail will not be published. Required fields are marked *