class

Retrieves the class type of the given input, x.

Syntax

R = class(x)

Inputs

x
Type: Any data type.

Outputs

R
Class type of input. The options for R are 'cell', 'char', 'double', 'function_handle', 'logical' and 'struct'
Type: string

Example

disp(class({1, 2, 3}));
disp(class(123)) 
disp(class(true));        
disp(class('mystring'));
disp(class(@sin));       
st.a = 1;
disp(class(st));
cell
double
logical
char
function_handle
struct