\section{CSVWRITE Write Comma Separated Value (CSV) File}

\subsection{Usage}

The \verb|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 \verb|csvread| has limits on line length.  If you need to
reliably read and write large matrices, use \verb|rawwrite| and
\verb|rawread| respectively.  The syntax for \verb|csvwrite| is 
\begin{verbatim}
   csvwrite('filename',x)
\end{verbatim}
where \verb|x| is a numeric array.  The contents of \verb|x| are written
to \verb|filename| as comma-separated values.  You can also specify
a row and column offset to \verb|csvwrite| to force \verb|csvwrite| to
write the matrix \verb|x| starting at the specified location in the 
file.  This syntax of the function is
\begin{verbatim}
   csvwrite('filename',x,startrow,startcol)
\end{verbatim}
where \verb|startrow| and \verb|startcol| are the offsets in zero-based
indexing.  
\subsection{Example}

Here we create a simple matrix, and write it to a CSV file
\begin{verbatim}
--> x = [1,2,3;5,6,7]
x = 
  <int32>  - size: [2 3]
 
Columns 1 to 3
 1  2  3  
 5  6  7  
--> csvwrite('csvwrite.csv',x)
--> csvread('csvwrite.csv')
ans = 
  <int32>  - size: [2 3]
 
Columns 1 to 3
 1  2  3  
 5  6  7  

\end{verbatim}
Next, we do the same with an offset.
\begin{verbatim}
--> csvwrite('csvwrite.csv',x,1,2)
--> csvread('csvwrite.csv')
ans = 
  <double>  - size: [3 4]
 
Columns 1 to 4
 0  0  0  0  
 0  1  2  3  
 0  5  6  7  

\end{verbatim}
Note the extra zeros.
