| Development Environment |    | 
Exporting ASCII Data 
This section describes how to use MATLAB functions to export data in several common ASCII formats. For example, you can use these functions to export a MATLAB matrix as a text file where the rows and columns are represented as space-separated, numeric values. The function you use depends on the amount of data you want to export and its format. Topics covered include
 
If you are not sure which section describes your data, scan the data format samples in Table 6-3 and look for the sample that most nearly matches the data format you want to create. Then read the section referred to in the table. 
If you are familiar with MATLAB export functions but are not sure when to use them, view Table 6-4, which compares the features of each function.
| Note    
If C or Fortran routines for writing data files in the form needed by other applications exist, create a MEX file to write the data. See the External Interfaces/API documentation for more information. | 
Table 6-3:   ASCII Data File Formats and MATLAB Export Commands
 
 
Table 6-4:   ASCII Data Export Function Feature Comparison
| Function 
 | Use With 
 | Delimiter 
 | Notes 
 | 
| csvwrite
 | Numeric data 
 | Only comma 
 | Primarily used with spreadsheet data. See also the binary format spreadsheet export functions. 
 | 
| diary
 | Numeric data or cell array 
 | Only space 
 | Can be used for small arrays. Requires editing of data file to remove extraneous text. 
 | 
| dlmwrite
 | Numeric data 
 | Any character 
 | Easy to use, flexible. 
 | 
| fprintf
 | Alphabetic and numeric data 
 | Any character 
 | Part of low-level file I/O routines. This is the most flexible command but also the most difficult to use. You must use fopento obtain a file identifier before writing the data andfcloseto close the file after writing the data.
 | 
| save
 | Numeric data 
 | Tab or space 
 | Easy to use; output values are high precision. 
 | 
 
 
|   | Importing Mixed Alphabetic and Numeric Data |  | Exporting Delimited ASCII Data Files |  |