I defined an abstract base class measurementHandler < handle , which defines an interface for all inherited classes. Two subclasses of this class are: a < measurementHandler and b < measurementHandler .
Now I have a function that should return a handle to an instance of any of these subclasses (depending on the arguments of the function) to the caller. Consider something like this:
function returnValue = foobar(index) if index == 0 returnValue = a(); else returnValue = b(); end end
This function is enclosed in the MATLAB Function block in Simulink (2013). When I try to simulate a system, I get the following error:
Type name mismatch (a ~= b).
Can anyone suggest a workaround for this that still allows me to use OOP and inheritance while using Simulink?
source share