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,

execute these commands at the MATLAB prompt to export this array using diary:

  1. Turn on the diary function. You can optionally name the output file diary creates.
  2. Display the contents of the array you want to export. This example displays the array A. You could also display a cell array or other MATLAB data type.
  3. Turn off the diary function.
  1. diary creates the file my_data.out and records all the commands executed in the MATLAB session until it is turned off.

  1. Open the diary file my_data.out in a text editor and remove all the extraneous text.

  Exporting Delimited ASCII Data Files Importing Binary Data