Development Environment    

Exporting Binary Data

To export binary data in one of the standard binary formats, you can use the MATLAB high-level function designed to work with that format.

To find the function designed to work with a particular binary data format, scan the data formats listed in Table 6-7. The table lists the binary formats and the MATLAB high-level functions you use to import them, with pointers to sources of additional information.

Table 6-7: Binary Data Formats and MATLAB Export Functions

Data Format
File Extension
Description
Audio files
.au
.wav

Use the auwrite function to export audio files on Sun Microsystems platforms and the wavwrite function to export audio files in Microsoft Windows format.
Audio Video Interleaved (AVI)
.avi
You must use the avifile, addframe, and the close function overloaded for AVI data to export a sequence of MATLAB figures in AVI format. See Exporting MATLAB Graphs in AVI Format for more information.
Hierarchical Data Format (HDF)
.hdf
To export image data in HDF format, use imwrite. For all other HDF formats, see Working with HDF Data for complete information.
Image files
.jpeg .tiff .bmp
.png
.hdf
.pcx
.xwd

Use the imwrite function to export image data in many different formats. See Reading, Writing, and Querying Graphics Image Files for more information.
MATLAB proprietary format (MAT-files)
.mat
Use the save command to export data in MATLAB proprietary format. See Saving the Current Workspace for more information.
Spreadsheets
.xls
.wk1

Use the wk1write function to export data in Lotus 123 format.

To view the alphabetical list of MATLAB binary data export functions, see Table 6-6.

If MATLAB does not support a high-level function that works with a data format, you can use the MATLAB low-level file I/O functions, if you know how the binary data is formatted in the file. See Using Low-Level File I/O Functions for more information.

Table 6-8: Binary Data Export Functions

Function
File Extension
Data Format
addframe
.au
Capture snapshots of the current axes and put them in an AVI file object. See also avifile.
auwrite
.au
Export sound data in Sun Microsystems format.
avifile
.au
Export audio-visual data in AVI format. Creates an AVI file object. See also addframe.
hdf
.hdf
Export data in Hierarchical Data Format (HDF). For HDF image file formats, use imwrite. For all other HDF files, see Working with HDF Data for complete information.
imwrite
.jpeg, .tiff, .bmp, .png, .hdf, .pcx, .xwd
Export image files in many formats.
save
.mat
Export MATLAB variables in MAT-files format.
wavwrite
.wav
Export sound data on Microsoft Windows platforms.
wk1write
.wk1
Export data in Lotus 123 spreadsheet format.

 Using Import Functions with Binary Data Exporting MATLAB Graphs in AVI Format