Saving simulation data from SimScape blocks to workspace
3 views (last 30 days)
Show older comments
Hello everybody,
I have multiple SimScape models which I call during execution of a Matlab-script. After the simulation of one SimScape-model has terminated, I need to process the results further. So what I need to have is the Simulation-Output as a workspace variable. I do not want to use the "toWorkspace" block because I would have to add a lot of "Temperatur-Sensor-Blocks" to my thermal model, which seems to be unnecessary as explained below. In contrary, I want to use the Data which is automatically generated within a SimScape-Block (e.g. a Thermal Mass Block).
The Data is already written to Workspace and I can access them in the following way:
plot(ans.Temperaturen.Back_Iron.T.series.time,ans.Temperaturen.Back_Iron.T.series.values('degC'),'b');
What is visible from this command: I changed the "workspace variable name" in Simulink -> Model Settings->SimScape->workspace variable name to "Temperaturen".
Nevertheless the data appears in the Workspace as "ans" (and the underlying sections of the structure, e.g. Back_Iron, is not visible"). This causes problems because if I want to access the data of the following Simulation model, I first have to clear the variable "ans".
Does anybody know how I have to change the settings in Simulink so that the Simulation output is only named "Temperaturen" without the "ans"?
Thank you so much in advance for your help!
Edit: grammar, precision of description
1 Comment
Fangjun Jiang
on 17 Mar 2020
It's strange. The variable in the workspace after the simulation should be "Temperaturen" as you set it. "ans" is the reserved variable name for "most recent answer". Please start from fresh to see what is happening. See example model "sh_cyl_closed_circuit.slx"
Answers (0)
See Also
Categories
Find more on Creating Custom Components and Libraries in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!