\section{NUMEL Number of Elements in an Array}

\subsection{Usage}

Returns the number of elements in an array \verb|x|, or in a subindex
expression.  The syntax for its use is either
\begin{verbatim}
   y = numel(x)
\end{verbatim}
or 
\begin{verbatim}
   y = numel(x,varargin)
\end{verbatim}
Generally, \verb|numel| returns \verb|prod(size(x))|, the number of total
elements in \verb|x|.  However, you can specify a number of indexing
expressions for \verb|varagin| such as \verb|index1, index2, ..., indexm|.
In that case, the output of \verb|numel| is 
\verb|prod(size(x(index1,...,indexm)))|.
\subsection{Example}

For a \verb|4 x 4 x 3| matrix, the length is \verb|4|, not \verb|48|, as you 
might expect, but \verb|numel| is \verb|48|.
\begin{verbatim}
--> x = rand(4,4,3);
--> length(x)

ans = 

 4 

--> numel(x)

ans = 

 48 


\end{verbatim}
Here is an example of using \verb|numel| with indexing expressions.
\begin{verbatim}
--> numel(x,1:3,1:2,2)

ans = 

 6 


\end{verbatim}
