# 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

```matlab
A = 3;
res = class(A)
```

```matlab
C = [1 ; 3];
res = class(C)
```

```matlab
addpath([nelsonroot(), '/modules/overload/examples/complex']);
c = complexObj(3,4);
class(c)
```

## See also

[isa](isa), [isdouble](https://github.com/Nelson-numerical-software/nelson-gitbook/blob/master/en/types/isdouble.html), [isfloat](isfloat), [ischar](ischar), [isstruct](isstruct), [iscell](iscell).

## History

| Version | Description     |
| ------- | --------------- |
| 1.0.0   | initial version |

## Author

Allan CORNET
