\section{TYPEOF Determine the Type of an Argument}

\subsection{Usage}

Returns a string describing the type of an array.  The syntax for its use is
\begin{verbatim}
   y = typeof(x),
\end{verbatim}
The returned string is one of
\begin{itemize}
\item  \verb|'cell'| for cell-arrays

\item  \verb|'struct'| for structure-arrays

\item  \verb|'logical'| for logical arrays

\item  \verb|'uint8'| for unsigned 8-bit integers

\item  \verb|'int8'| for signed 8-bit integers

\item  \verb|'uint16'| for unsigned 16-bit integers

\item  \verb|'int16'| for signed 16-bit integers

\item  \verb|'uint32'| for unsigned 32-bit integers

\item  \verb|'int32'| for signed 32-bit integers

\item  \verb|'float'| for 32-bit floating point numbers

\item  \verb|'double'| for 64-bit floating point numbers

\item  \verb|'complex'| for complex floating point numbers with 32-bits per field

\item  \verb|'dcomplex'| for complex floating point numbers with 64-bits per field

\item  \verb|'string'| for string arrays

\end{itemize}
\subsection{Example}

The following piece of code demonstrates the output of the \verb|typeof| command for each possible type.  The first example is with a simple cell array.
\begin{verbatim}
--> typeof({1})
ans = 
  <string>  - size: [1 4]
 cell

\end{verbatim}
The next example uses the \verb|struct| constructor to make a simple scalar struct.
\begin{verbatim}
--> typeof(struct('foo',3))
ans = 
  <string>  - size: [1 6]
 struct

\end{verbatim}
The next example uses a comparison between two scalar integers to generate a scalar logical type.
\begin{verbatim}
--> typeof(3>5)
ans = 
  <string>  - size: [1 7]
 logical

\end{verbatim}
For the smaller integers, and the 32-bit unsigned integer types, the typecast operations are used to generate the arguments.
\begin{verbatim}
--> typeof(uint8(3))
ans = 
  <string>  - size: [1 5]
 uint8
--> typeof(int8(8))
ans = 
  <string>  - size: [1 4]
 int8
--> typeof(uint16(3))
ans = 
  <string>  - size: [1 6]
 uint16
--> typeof(int16(8))
ans = 
  <string>  - size: [1 5]
 int16
--> typeof(uint32(3))
ans = 
  <string>  - size: [1 6]
 uint32

\end{verbatim}
The 32-bit signed integer type is the default for integer arguments.
\begin{verbatim}
--> typeof(-3)
ans = 
  <string>  - size: [1 5]
 int32
--> typeof(8)
ans = 
  <string>  - size: [1 5]
 int32

\end{verbatim}
Float, double, complex and double-precision complex types can be created using the suffixes.
\begin{verbatim}
--> typeof(1.0f)
ans = 
  <string>  - size: [1 5]
 float
--> typeof(1.0D)
ans = 
  <string>  - size: [1 6]
 double
--> typeof(1.0f+i)
ans = 
  <string>  - size: [1 7]
 complex
--> typeof(1.0D+2.0D*i)
ans = 
  <string>  - size: [1 8]
 dcomplex

\end{verbatim}
