class

Return classname of object or creates a named object.

Syntax

  • name = class(var)

  • obj = class(st, strname)

Input argument

  • var - a variable

  • st - a struct

  • strname - a string: classname desired

Output argument

  • name - a string

  • obj - an object of type 'strname' based on struct 'st'

Description

name = class(var) returns the class of var variable.

Standard classes are:

'cell'

'struct'

'single'

'double'

'logical'

'char'

'int8'

'int16'

'int32'

'int64'

'uint8'

'uint16'

'uint32'

'uint64'

'function_handle'

Examples

A = 3;
res = class(A)
C = [1 ; 3];
res = class(C)
addpath([nelsonroot(), '/modules/overload/examples/complex']);
c = complexObj(3,4);
class(c)

See also

isa, isdouble, isfloat, ischar, isstruct, iscell.

History

VersionDescription

1.0.0

initial version

Author

Allan CORNET

Last updated