MATLAB Answers

How do I scan the model for parameters read/write?

2 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 9 月 4 日
回答済み: Jonas 2020 年 9 月 30 日
Is there a way to scan a model for any blocks that would read or write parameters to workspace. I need to clean-up a large model and I want to make sure no block are using or setting some values outside of want I know or want.
The same request also for file read or write.

採用された回答

MathWorks Support Team
MathWorks Support Team 2020 年 9 月 30 日
編集済み: MathWorks Support Team 2020 年 9 月 30 日
To find blocks that can read of write to worksapce or file, you may use the find_system function:
For example,
>> find_system('mymodel','BlockType','ToFile')
>> find_system('mymodel','BlockType','ToWorkspace')
>> find_system('mymodel','BlockType','FromFile')
>> find_system('mymodel','BlockType','FromWorkspace')
In addition, to find all blocks that are using variables in the workspace, you can consider using the Simulink.findVars function:
For example,
>> Simulink.findVars('mymodel','SourceType','base workspace')

  0 件のコメント

サインインしてコメントする。

その他の回答 (1 件)

Jonas
Jonas 2020 年 9 月 30 日
Another (and more user-friendly in my opinion) way to find certain blocks in your model, is by using the search function in the Model Explorer, and selecting the specific Block Type that you are looking for, such as a To Workspace block.
The search procedure will provide you with a list of all the blocks, including a link to directly navigate to the block in your model.

  0 件のコメント

サインインしてコメントする。

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by