Why does the SIM command from Simulink 4.0 (R12) work incorrectly when you do not use left-hand arguments?

2 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Jan 2010
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.

More Answers (0)

Categories

Find more on Physical Units in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!