find_system versus Simulink.findVars
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a reasonably large model (~30,000 blocks) I'm trying to automate the changing of variable references in. The goal is to put "this_prefix." in front of variable references for a specific field (i.e. 'Value' for block type "Constant", 'Gain' for block type "Gain", etc.) in order to put all 1800+ Workspace variables into one structure; however, there is a catch. I want to leave blocks that are masked alone but I do want to change the fields in the parent masking block.
If possible, I'd like to look at only those blocks which use a variable in the workspace (hence the Simulink.findVars command) but cannot use the argument " 'LookUnderMasks', 'none' " that is present in find_system command because, as far as I can tell, it doesn't exist.
So far, I can get the "block address" for each block, and get_param works nicely for each one; I just can't figure out how to not have the code completely skip a masking block, or even tell if it's looking at them.
I'm cautious to share any code because it's all proprietary.
Thanks in advance.
-Bo
댓글 수: 0
채택된 답변
Guy Rouleau
2013년 7월 12일
Simulink.findVars returns a list of simulink.variableusage objects.
This object has a "Source" property telling you where the variable comes form. Using that should allow you to only rename the variables you are looking for.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!