MATLAB 帮助中心
确定 C++ 对象是否为只读
tf = clibIsReadOnly(cppObj)
如果 cppObj 为只读,tf = clibIsReadOnly(cppObj) 将返回逻辑值 1 (true)。否则,将返回逻辑值 0 (false)。
cppObj
1
true
0
false
示例
全部折叠
const
nonconst
假设您有一个适用于此 C++ 库 MyClass 的 MATLAB® 接口:
MyClass
const class MyClass { public: int val1; int val2; }; const MyClass& func();
在 MATLAB 中调用函数 func 来创建一个常量 MyClass 对象:
func
res = clib.MyClass.func()
res = read-only MyClass with properties: val1: 1 val2: 2
验证该对象是只读的:
clibIsReadOnly(res)
ans = logical 1
该函数返回逻辑值 1 (true),表示该对象为只读。
在 MATLAB 中创建的 C++ 对象,指定为句柄。
在 R2019b 中推出
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处