class_()

Environment

class_() is a MATLAB®-compatible environment function for return the class/type of a value as a string. returns 'double' for plain numbers/arrays, 'char' for strings, 'logical' for booleans, 'cell' for cell arrays, 'struct' for plain objects, or the typed-numeric kind ('int8', 'uint16', 'single', etc.) for typed values. also returns system types ('tf', 'ss', 'zpk') for control objects, 'containers.map' for maps, and 'table' for tables. Run it online in your browser with SimLab — free, no install, no license required.

Return the class/type of a value as a string. Returns 'double' for plain numbers/arrays, 'char' for strings, 'logical' for booleans, 'cell' for cell arrays, 'struct' for plain objects, or the typed-numeric kind ('int8', 'uint16', 'single', etc.) for typed values. Also returns system types ('tf', 'ss', 'zpk') for control objects, 'containers.Map' for maps, and 'table' for tables.

Syntax

class(x)

Examples — run class_() in your browser

class(42)
▶ Run
class('hello')
▶ Run
class(int8(10))
▶ Run
class(uint16(500))
▶ Run
class(logical(1))
▶ Run

See Also

Frequently Asked Questions about class_()

Is the class_() function free to use in SimLab?

The browser workspace requires no MATLAB® license or installation. Connected features require network access and may have account, tier, availability, or usage limits. You can open class_() and 510+ other MATLAB®-compatible function references at simulations4all.com/simlab.

Do I need to install MATLAB to use class_()?

No. SimLab’s core parser, workspace state, and most functions run locally in your browser. The class_() function requires no MATLAB® license or desktop software download.

What does class_() do?

Return the class/type of a value as a string. Returns 'double' for plain numbers/arrays, 'char' for strings, 'logical' for booleans, 'cell' for cell arrays, 'struct' for plain objects, or the typed-numeric kind ('int8', 'uint16', 'single', etc.) for typed values. Also returns system types ('tf', 'ss', 'zpk') for control objects, 'containers.Map' for maps, and 'table' for tables. It is a MATLAB®-compatible environment function available in SimLab with the same calling syntax as MATLAB® — typically: class(x).

Can I run class_() in my browser?

Yes. Open SimLab at simulations4all.com/simlab, write or paste code that calls class_(), and run it. This function’s calculation runs locally in the browser. SimLab session analytics, sharing, feedback, and eligible acceleration have separate network boundaries.

Try SimLab — MATLAB®-compatible, free, in your browser

510+ functions. Runs in your browser. No install. No license.

Open SimLab

MATLAB® is a registered trademark of The MathWorks, Inc. SimLab is an independent project by Simulations4All and is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

Stay Updated

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