I managed to get it running. Actually without any change. Apparently I had to restart Simulink (perhaps some class instances was being kept between runs?). But now, testing the setup with some data in the objects as states it seems I have hit a brick wall. In the outputs method of the somclass class I have the following:
function outputs(obj,block)
% Called to generate block outputs in simulation step.
obj.counter = obj.counter + 1;
block.OutputPort(2).Data = obj.counter;
block.OutputPort(1).Data = block.InputPort(1).Data;
end
which as shown should output (to the second port) the current counter (a property of instances of someclass.m) after iterating it. The thing is I get a constant output of 1 which is consistent with the scenario where Simulink at each simulation step instantiates a new object of someclass... The only way to have object properties as states is for this object to persist through the whole simulation. The help system is very limited in its wordings about the 'UserData' field. Is there anyway to obtain the persistence I need? Again, help is much appreciated.
Erwin