External Interfaces/API |
Exporting Data from MATLAB
There are several methods for getting MATLAB data back to the outside world:
diary
command to create a diary file and display the variables, echoing them into this file. You can use your text editor to manipulate the diary file at a later time. The output of diary
includes the MATLAB commands used during the session, which is useful for inclusion into documents and reports.
save
command with the -ascii
option. For example,
creates an ASCII file called temp.dat
containing
1.3889088e-001 2.7218792e-001 4.4509643e-001 2.0276522e-001 1.9881427e-001 9.3181458e-001 1.9872174e-001 1.5273927e-002 4.6599434e-001 6.0379248e-001 7.4678568e-001 4.1864947e-001
The -ascii
option supports two-dimensional double and character arrays only. Multidimensional arrays, cell arrays, and structures are not supported.
See the save
function reference page for more information.
fopen
, fwrite
, and the other low-level I/O functions. This method is useful for writing data files in the file formats required by other applications.
save
command. You can then write a program in C or Fortran to translate the MAT-file into your own special format. See the section, Reading and Writing MAT-Files, for more information.
Importing Data to MATLAB | Exchanging Data Files Between Platforms |