matlab frequently-used function
class
功能
- 返回給定對象的類型Return class name of object.類似於python中的
type
函數
語法Syntax
-
S = class(OBJ)
%returns the name of the class of object OBJ. -
Possibilities are:
double –Double precision floating point number matrix or array single –Single precision floating point number array logical – Logical array char – Character array cell – Cell array struct – Structure array function_handle – Function Handle int8 – 8-bit signed integer array uint8 – 8-bit unsigned integer array int16 – 16-bit signed integer array uint16 – 16-bit unsigned integer array int32 – 32-bit signed integer array uint32 – 32-bit unsigned integer array int64 – 64-bit signed integer array uint64 – 64-bit unsigned integer array class_name – MATLAB class name for MATLAB objects java_class – Java class name for java objects -
Example 1: Obtain the name of the class of value PI
name = class(PI);
-
similar function
See also isa, superiorto, inferiorto, classdef, struct.
其他
- 更多細節通過
doc class
查看API
whos
功能
- List variables in workspace, with sizes and types;比
class
更加詳細
語法
whos
:返回當前活動工作空間的所有變量的信息whos(variables)
:返回指定命名的變量信息whos(location)
:返回指定位置的變量信息whos(variables,location)
S = whos(_)
:stores information about the variables in structure array, S, using no input arguments, or any of the input arguments from the previous syntaxes.將這些信息複製給結構體變量存儲。
其他
- 更多細節通過
doc whos
查看API