本文共 680 字,大约阅读时间需要 2 分钟。
在C语言中获取字节数的函数是sizeof,而在matlab中获取字节的办法就是用whos函数
使用:help whos,即可以得到相关的whos的介绍,其中一种用法是 S = WHOS(...) returns a structure with the fields: name -- variable name size -- variable size bytes -- number of bytes allocated for the array class -- class of variable global -- logical indicating whether variable is global sparse -- logical indicating whether value is sparse complex -- logical indicating whether value is complex nesting -- struct with the following two fields: function -- name of function where variable is defined level -- nesting level of the function persistent -- logical indicating whether variable is pe举例:获取字符串的字节数
str='abc'; s=whos(str); byte=s.bytes;%即可以获得字节数,为6转载地址:http://efqbi.baihongyu.com/