Nick
Nick

Reputation: 2980

View class properties while debugging matlab function block in simulink

Is it possible to view the handle class properties when debugging a matlab function block in simulink?

Currently I have a matlab function block which instantiates a class. In neither the function block or the class itself can I see the properties of the class during debug. My workspace is empty.

When I run who while debugging I only get variables inside the function scope and no persistent variables (in the function block) and no class properties (inside the class itself).

The only way to debug now is to store properties inside a local variable.

Upvotes: 1

Views: 351

Answers (1)

Navan
Navan

Reputation: 4477

Viewing class information is not supported by MATLAB Function block when debugging. The only way is to assign property values to local variables. Documentation at http://www.mathworks.com/help/simulink/ug/how-working-with-matlab-classes-is-different-for-code-generation.html has a line "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

In the above code for function my_fcn you can see in, o and my_prop. But not obj.

Upvotes: 1

Related Questions