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 the input. The options for R include:
  • 'cell'
  • 'char'
  • 'double'
  • 'function_handle'
  • 'logical'
  • '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