博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
获取字节数
阅读量:4031 次
发布时间:2019-05-24

本文共 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/

你可能感兴趣的文章
WPF中PATH使用AI导出SVG的方法
查看>>
WPF UI&控件免费开源库
查看>>
QT打开项目提示no valid settings file could be found
查看>>
Win10+VS+ESP32环境搭建
查看>>
Ubuntu+win10远程桌面
查看>>
flutter-实现圆角带边框的view(android无效)
查看>>
flutter-实现一个下拉刷新上拉加载的列表
查看>>
android 代码实现圆角
查看>>
postman调试webservice接口
查看>>
flutter-解析json
查看>>
android中shader的使用
查看>>
java LinkedList与ArrayList迭代器遍历和for遍历对比
查看>>
Android DataBinding使用2-Recycleview
查看>>
drat中构造方法
查看>>
JavaScript的一些基础-数据类型
查看>>
JavaScript基础知识(2)
查看>>
转载一个webview开车指南以及实际项目中的使用
查看>>
关于activity保存页面状态的两个方法
查看>>
android中对于非属性动画的整理
查看>>
一个简单的TabLayout的使用
查看>>