Code covered by the BSD License  

Highlights from
double2ascii

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 2 KB File ID: #1631

double2ascii

by Denis Gilbert

 

25 Apr 2002 (Updated 26 Apr 2002)

Writes double array X to an output ASCII file.

| Watch this File

File Information
Description

DOUBLE2ASCII writes an input double array to an output ASCII file. If a single format specifier is specified in the input format string, that format will be used for all columns of X. The user may also specify different formats for each column of the double array X.

Example 1: Export array X to ASCII file with the same format for all columns.
 
X = rand(300,10);
double2ascii('foo1.txt', X, '%4.2f');

Example 2: Export array X to ASCII file with a different format for each column.
 
year = (1991:2000)';
x = (1:10)';
column2 = x / 100;
column3 = x * 1e27;
X = [ year column2 column3];
double2ascii('foo2.txt', X, '%d %5.2f %10.3e');

produces an ASCII file that looks like this:

1991 0.01 1.000e+027
1992 0.02 2.000e+027
1993 0.03 3.000e+027
1994 0.04 4.000e+027
1995 0.05 5.000e+027
1996 0.06 6.000e+027
1997 0.07 7.000e+027
1998 0.08 8.000e+027
1999 0.09 9.000e+027
2000 0.10 1.000e+028

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Denis Gilbert 22 Oct 2008 06:44:10
data export Denis Gilbert 22 Oct 2008 06:44:10
double2ascii Denis Gilbert 22 Oct 2008 06:44:10
ascii Denis Gilbert 22 Oct 2008 06:44:10
double array Denis Gilbert 22 Oct 2008 06:44:10
exporting variables Denis Gilbert 22 Oct 2008 06:44:10
export to file Denis Gilbert 22 Oct 2008 06:44:10

Contact us at files@mathworks.com