MATLAB: Does the SIM command from Simulink 4.0 (R12) work incorrectly when you do not use left-hand arguments

argumentscommandhandleftliner12simsimulationsimulink

Why does the SIM command from Simulink 4.0 (R12) work incorrectly when you do not use left-hand arguments?
The following code will illustrate this problem:
vdp;
set_param('vdp', 'SaveFinalState', 'On');
a=simget('vdp');
a=simset(a, 'FinalStateName','myname');
a.FinalStateName
sim('vdp', 20, a);
whos
The SIMSET command works and sets a new name instead of the default name "xFinal". However, after the simulation "xFinal" instead of "myname", is written in the workspace.
If you use left-hand arguments with the SIM command, it works correctly:
[t,x,y]=sim('vdp',20,myopts);
returns the changed name.
sim('vdp',20,myopts);
returns the default name.

Best Answer

This enhancement has been incorporated in Release 2009b (R2009b). For previous product releases, read below for any possible workarounds:
This inconsistency has been verified in Simulink.
As a workaround, use the SIM command with left-hand arguments.