- In your referenced model, right-click the signal you would like to log and select "Log Selected Signal".
- In your top-level model, if you keep all parameters in the Configuration Parameters > Data Import/Export pane set to their default values (i.e., "Single simulation output" enabled and set to a variable named "out"), then you can see all instances of the logged signal by inspecting the variable "out" after simulating the top-level model.
Is it possible to use "To Workspace" blocks in multi-instance model references in Simulink R2024b?
조회 수: 14 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2025년 12월 17일 0:00
답변: MathWorks Support Team
2025년 12월 17일 16:35
I have a top-level model that references a "child model" multiple times. The child model contains a "To Workspace" block that writes to a variable named "myVar" in the workspace (the "Variable name" property of the block is set to "myVar"). Upon simulating the top-level model, I encounter the following error:
Duplicate data logging variable name, 'myVar' specified in 'refModel/To Workspace'
I've tried parametrizing the "Variable name" property of the "To Workspace" block so that the top-level model can provide unique variable names for each of the reference instances. However, I keep running into issues with the parametrization.
Is it possible to have "To Workspace" blocks in multi-instance model references? If not, what are workarounds to log the data from all instances of the model reference?
채택된 답변
MathWorks Support Team
2025년 12월 17일 0:00
It is not possible to use "To Workspace" blocks in multi-instance model references. The "Variable name" property cannot be changed in the different instances because it's not a tunable parameter.
Instead, we recommend using Simulation Data Inspector to view and analyze logged signals in referenced models. For example, this workflow might look as follows:
For more information on using Simulation Data Inspector to log signals in referenced models, please see our documentation on viewing signals in model reference instances.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Save Run-Time Data from Simulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!