miss_hit
miss_hit copied to clipboard
check for simulink unsupported property initializations
What kind of feature is this?
- catch matlab constructs that will fail code generation early on
- specifically, Code generation only supports initial values of class type for constant properties
Your MATLAB/Octave environment
- MATLAB R2017b
MISS_HIT component affected Choose one or more of the below:
- mh_lint
Describe the solution you'd like in classes, properties may be initialized in the properties block itself, e.g.
properties
cats = uint8(6)
end
However, code generation only supports this for assignments that use only build-ins. So custom class constructors / functions won't work, e.g.
properties
cat = Cat() % Cat being a custom class
end
This is fine when you don't generate code from is but will cause an error during code generation "Code generation only supports initial values of class type for constant properties". It'd be nice if this was caught by miss_hit early on.