在 simulink 中调试 matlab 函数块时查看 class 属性

View class properties while debugging matlab function block in simulink

在simulink中调试matlab功能块时是否可以查看句柄class属性?

目前我有一个实例化 class 的 matlab 函数块。在调试期间,在功能块或 class 本身中,我都看不到 class 的属性。我的工作区是空的。

当我 运行 who 调试时,我只得到函数范围内的变量,没有持久变量(在函数块中),也没有 class 属性(在 class 本身)。

现在唯一的调试方法是将属性存储在局部变量中。

调试时 MATLAB Function 块不支持查看 class 信息。唯一的方法是将 属性 值分配给局部变量。 http://www.mathworks.com/help/simulink/ug/how-working-with-matlab-classes-is-different-for-code-generation.html 的文档有一行 "If you use classes in code in the MATLAB Function block, you cannot use the debugger to view class information.".

classdef foo < handle
  methods
    function o = my_fcn(obj, in)
       my_prop = obj.my_prop;
       o = in * my_prop;
    end
  end
end

在上面函数 my_fcn 的代码中,您可以看到 in, o and my_prop。但不是 obj.