class_

Environment

Return the class/type of a value as a string. Returns 'double' for numbers/arrays, 'char' for strings, 'logical' for booleans, 'cell' for cell arrays, 'struct' for objects, or the system type ('tf', 'ss', 'zpk') for control objects.

Syntax

class(x)

Examples

class(42)
▶ Run
class('hello')
▶ Run
class(tf([1], [1, 1]))
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.