1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Usage
The csvwrite function writes a given matrix to a text file
using comma separated value (CSV) notation. Note that you
can create CSV files with arbitrary sized matrices, but that
csvread has limits on line length. If you need to reliably
read and write large matrices, use rawwrite and rawread
respectively. The syntax for csvwrite is
csvwrite('filename',x)
where x is a numeric array. The contents of x are written to
filename as comma-separated values. You can also specify a
row and column offset to csvwrite to force csvwrite to write
the matrix x starting at the specified location in the file.
This syntax of the function is
csvwrite('filename',x,startrow,startcol)
where startrow and startcol are the offsets in zero-based
indexing.
Example
Here we create a simple matrix, and write it to a CSV file
--> x = [1,2,3;5,6,7]
x =
1 2 3
5 6 7
--> csvwrite('csvwrite.csv',x)
--> csvread('csvwrite.csv')
ans =
1 2 3
5 6 7
Next, we do the same with an offset.
--> csvwrite('csvwrite.csv',x,1,2)
--> csvread('csvwrite.csv')
ans =
0 0 0 0
0 1 2 3
0 5 6 7
Note the extra zeros.
* FreeMat_Documentation
* Input/Ouput_Functions
* Generated on Thu Jul 25 2013 17:17:38 for FreeMat by
doxygen_ 1.8.1.1
|