\section{ASSIGN Making assignments}

\subsection{Usage}

FreeMat assignments take a number of different forms, depending 
on the type of the variable you want to make an assignment to.
For numerical arrays and strings, the form of an assignment
is either
\begin{verbatim}
  a(ndx) = val
\end{verbatim}
where \verb|ndx| is a set of vector indexing coordinates.  This means
that the values \verb|ndx| takes reference the elements of \verb|a| in column
order.  So, if, for example \verb|a| is an \verb|N x M| matrix, the first column
has vector indices \verb|1,2,...,N|, and the second column has indices
\verb|N+1,N+2,...,2N|, and so on.  Alternately, you can use multi-dimensional
indexing to make an assignment:
\begin{verbatim}
  a(ndx_1,ndx_2,..,ndx_m) = val
\end{verbatim}
where each indexing expression \verb|ndx_i| corresponds to the \verb|i-th| dimension
of \verb|a|.  In both cases, (vector or multi-dimensional indexing), the
right hand side \verb|val| must either be a scalar, an empty matrix, or of the
same size as the indices.  If \verb|val| is an empty matrix, the assignment acts
like a delete.  Note that the type of \verb|a| may be modified by the assignment.
So, for example, assigning a \verb|double| value to an element of a \verb|float| 
array \verb|a| will cause the array \verb|a| to become \verb|double|.  

For cell arrays, the above forms of assignment will still work, but only
if \verb|val| is also a cell array.  If you want to assign the contents of
a cell in a cell array, you must use one of the two following forms, either
\begin{verbatim}
  a{ndx} = val
\end{verbatim}
or
\begin{verbatim}
  a{ndx_1,ndx_2,...,ndx_m} = val
\end{verbatim}
which will modify the contents of the cell.
