Development Environment | ![]() ![]() |
Using the diary Command to Export Data
To export small numeric arrays or cell arrays, you can use the diary
command. diary
creates a verbatim copy of your MATLAB session in a disk file (excluding graphics).
For example, if you have the array, A
, in your workspace
A = [ 1 2 3 4; 5 6 7 8 ];
execute these commands at the MATLAB prompt to export this array using diary
:
diary
function. You can optionally name the output file diary
creates. diary my_data.out
A
. You could also display a cell array or other MATLAB data type.A = 1 2 3 4 5 6 7 8
diary
function.diary off
diary
creates the file, my_data.out
, and records all the commands executed in the MATLAB session until it is turned off.
A = 1 2 3 4 5 6 7 8 diary off
![]() | Exporting Delimited ASCII Data Files | Importing Binary Data | ![]() |