Development Environment |
Using Import Functions with Binary Data
To import binary data from the command line or in an M-file, you must use one of the MATLAB import functions. Your choice of function depends on how the data in the text file is formatted.
To find the function designed to work with a particular binary data format, scan the data formats listed in Table 6-5. The table lists the binary formats and the MATLAB high-level functions you use to import them, along with pointers to additional information. To view the alphabetical list of MATLAB binary data export functions, see Table 6-6.
Note If MATLAB does not support a high-level function that works with a particular binary data format, use the MATLAB low-level file I/O functions to import the data. You must know how the binary data is formatted in the file. See Using Low-Level File I/O Functions for more information. |
Data Format |
File Extension |
Function |
Audio files |
.au .wav |
auread (on Sun systems)wavread (on Microsoft Windows systems) |
Audio-video Interleaved (AVI) |
.avi |
aviread |
Band-interleaved data |
No standard file extension |
multibandread |
Common Data Format (HDF) |
.cdf |
cdfread |
Hierarchical Data Format (HDF) |
.hdf |
imread Use imread only f or HDF raster image files. For all other HDF files, see Importing HDF Data for complete information. |
Image files |
.bmp |
imread |
MATLAB proprietary format (MAT-files) |
.mat |
load See Loading a Saved Workspace and Importing Data for more information. |
Spreadsheets (Excel or Lotus 123) |
.xls |
xlsread |
Function |
File Extension |
Data Format |
auread |
.au |
Import sound data in Sun Microsystems format. |
aviread |
.avi |
Import audio-visual data in AVI format. |
cdfread |
.cdf |
Import Common Data Format (CDF) data. |
hdf |
.hdf |
Import data in Hierarchical Data Format (HDF). For HDF image file formats, use imread . For all other HDF files, see Importing HDF Data for complete information. |
imread |
.bmp |
Import images in many formats. |
load |
.mat |
Import MATLAB workspace variables in MAT-files format. |
multibandread |
No standard file extension |
Import three-dimensional, band-interleaved data. |
wavread |
.wav |
Import sound data in Microsoft Windows format. |
wk1read |
.wk1 |
Import data in Lotus 123 spreadsheet format. |
xlsread |
.xls |
Import data in Microsoft Excel spreadsheet format. |
Using the Import Wizard with Binary Data Files | Exporting Binary Data |