Simulink object... ...was changed during simulation
2 views (last 30 days)
Show older comments
When I run a simulation, I get error messages of the type:
An error occurred during simulation of Model block 'xxx.slx'.
Caused by:
- An error occurred during simulation of Model block 'xxx/submodel/submodel/yyy.slx'
- The Simulink signal object 'aaa' for output port 1 of block 'yyy/zzz' was changed during simulation
The things that was reported as "changed during simulation" are things that are expected to change during simulation, like a model output signal.
0 Comments
Answers (1)
Fangjun Jiang
on 20 Feb 2020
I had a user who had problem matching this although Simulink (earlier version) didn't give this exact error message.
There is a signal line labeled "aaa" in the model. There is an aaa=Simulink.Signal object in the base workspace. This is all good. The user also wanted to log the simulation data so he added a "ToWorkspace" block which connected to the "aaa" signal line. The problem is that he specified the ToWorkspace variable as "aaa" (make sense, right? after all, it is the signal name.) When the logged data is written to the workspace variable "aaa", it overwrites the signal object "aaa".
If this is what happened to you, just change the data logging variable name.
In fact, Mathworks must have realized this problem and has fixed it (at least in R2019b). Now when you specify the data logging variable as "aaa", it is saved to out.aaa.
4 Comments
Fangjun Jiang
on 20 Feb 2020
Edited: Fangjun Jiang
on 20 Feb 2020
Without the model, I could only guess, although I can't explain the different behavior between laptop and desktop.
Do you have name conflicts between signal and data store memory, meaning a "aaa" singal object in the base workspace but there is an "aaa" signal line label in the model and "aaa" is used as the name for DataStore Memory/Read/Write block?
From the document
You can use Simulink.Signal objects in addition to, or instead of, Data Store Memory blocks to define data stores. A data store defined in the baseworkspace with a signal object is a global data store.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!