23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6 Data Import and Export<br />

Preferences for <strong>MATLAB</strong> in the Desktop Tools and Development Environment<br />

documentation for more information.<br />

When writing character data to a non-HDF5-based MAT-file using Unicode<br />

encoding (the default), <strong>MATLAB</strong> checks if the data is 7-bit ASCII. If it is,<br />

<strong>MATLAB</strong> writes the 7-bit ASCII character data to the MAT-file using 8 bits<br />

per character (UTF-8 format), thus minimizing the size of the resulting file.<br />

Any character data that is not 7-bit ASCII is written in 16-bit Unicode form<br />

(UTF-16). This algorithm operates on a per-string basis.<br />

Note You cannot read a Unicode encoded MAT-file with <strong>MATLAB</strong> versions<br />

earlier than Version 7. To write a MAT-file that you will be able to read<br />

with one of these versions, save to the file with Unicode character encoding<br />

disabled.<br />

For more information on how <strong>MATLAB</strong> saves specific ASCII data formats,<br />

and on preventing loss or corruption of character data, see “Writing Character<br />

Data” in the <strong>MATLAB</strong> External Interfaces documentation.<br />

Optional Output Formats<br />

You can choose from any of the following formats for your output file. If you do<br />

not specify a format, <strong>MATLAB</strong> uses the binary MAT-file format.<br />

Output File Format<br />

Binary MAT-file (default)<br />

8-digit ASCII<br />

8-digit ASCII, tab delimited<br />

16-digit ASCII<br />

16-digit ASCII, tab delimited<br />

Command<br />

save filename<br />

save filename -ascii<br />

save filename -ascii -tabs<br />

save filename -ascii -double<br />

save filename -ascii -double -tabs<br />

<strong>MATLAB</strong> Version 4 compatible save filename -v4<br />

Saving in ASCII Format. When saving in any of the ASCII formats, consider<br />

the following:<br />

6-28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!