How do I export internal variables from a Simscape file to the MATLAB Workspace, in Simscape ?
9 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2013 年 6 月 7 日
編集済み: MathWorks Support Team
2025 年 3 月 7 日
I have a Simscape file that uses some internal variables that are not exposed as block outputs. I would like to be able to output these variables to the MATLAB Workspace for inspection.
I realize that I could convert these variables to block outputs to gain access to them, but I would prefer to avoid this approach if possible.
採用された回答
MathWorks Support Team
2025 年 3 月 7 日
編集済み: MathWorks Support Team
2025 年 3 月 7 日
There are two ways to log Simscape data:
.
It is possible to use the 'Log simulation data' option in the Configuration Parameters to log data from internal variables to the workspace:
To explore this feature, you can create a model using the “Spring” Simscape file example:
In the “Spring” example, an internal variable named “theta” is used. If you turn on data logging as shown at the following link, the workspace variable will contain "theta". The results can be viewed in "Simscape Results Explorer" (R2014b+):
.
Starting in R2024a, you can log individual Simscape block variables, including from custom components, to the workspace and view them in the "Simulation Data Inspector":
To explore this feature, see the following example:
You can also manage selective logging instrumentation programmatically. To learn more, see::
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Logging についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!