【发布时间】:2020-12-18 11:57:59
【问题描述】:
我正在使用 MATLAB 类并遇到属性问题。
我调用的代码是
theory = ODtheory;
theory.enableDebug(true);
theory.captureRange();
最后一个函数应该打印出值,因为调试设置为true
这是类的代码:
function obj = ODtheory(~)
obj.isDebug = false;
end
function obj = enableDebug(obj,value)
obj.isDebug = value;
end
但在function range = captureRange(obj) 中,变量(属性)obj.isDebug 仍设置为 false。
function range = captureRange(obj)
...
if obj.isDebug; disp(['FOW: ' num2str(round(FOW,1)) '/mm']); end
end
【问题讨论】:
标签: matlab class properties