sim command and to workspace logging

I am trying to run a model with the following script:
Test.Config.StartTime = '0.0';
Test.Config.StopTime = '100.0';
Test.Config.SolverType = 'Fixed-step';
Test.Config.Solver = 'FixedStepDiscrete';
Test.Config.FixedStep = '1.0';
sim('TH_CrossProduct',Test.Config);
This model has a 'To Workspace' block that is supposed to be logging a timeseries to a variable called 'Test_Output'. However, using the script above, I do not get a variable called 'Test_Output', I get a 'Simulink.SimulationOutput' object which contains 'Test_Output' assigned to 'ans'. But if I run the model using the following:
sim('TH_CrossProduct')
I do get a timeseries assigned to 'Test_Output'. Because of this, I am assuming that there is some parameter that needs to be passed via the 'Test.Config' structure to the model. However, I have no idea what this might be. Can anyone provide any help?
Thanks,
Ryan

Antworten (1)

Kaustubha Govind
Kaustubha Govind am 10 Aug. 2012
Bearbeitet: Kaustubha Govind am 10 Aug. 2012

1 Stimme

As described on this page of the documentation, SIM returning a Simulink.SimulationOutput object is the new syntax. Getting timeseries objects directly is only possible via the Backward Compatible syntax of the SIM command, so I think you might be able to get what you need by passing in the configuration parameters as a SIMSET:
opts = simset(simget('TH_CrossProduct'),'StartTime', '0.0', ...)
sim('TH_CrossProduct', opts)
However, this syntax still exists only for the sake of backwards compatibility, so you might be better advised to use the new syntax unless your code is expected to be executed in older versions of MATLAB.

Kategorien

Mehr zu Manage Design Data finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Gefragt:

am 10 Aug. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by