4.1变量类型(Class) 。字符串变量(char) 。数值型变量,包括双精度(double)、单精度 (single)等。 >clear all >str='Every good boy does fine.'; >x=1:5:100 >class(str) ans char >>class(x) ans double
l 字符串变量(char) l 数值型变量,包括双精度(double)、单精度 (single)等
●Whos能够查看变量类型(class)以及变量所占的 内存(Bytes) ●每个字符占2 bytes >whos Name Size Bytes Class Attributes ans 1x6 12 char str 1x25 50 char 1x20 160 double
l Whos能够查看变量类型(class)以及变量所占的 内存(Bytes) l每个字符占2 bytes
●Help class可提供所有变量类型 ·字符、数值、逻辑(logical)、结构(struct)、 单元(cell)等 >help class CLASS Return class name of object. S CLASS (OBJ)returns the name of the class of object OBJ. Possibilities are: double -Double precision floating point number array (this is the traditional MAILAB 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 usigned integer array int16 -16-bit signed integer array uint16 -16-bit usigned 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
l Help class可提供所有变量类型 l 字符、数值、逻辑(logical)、结构(struct)、 单元(cell)等