MATLAB Answers

How can I tell (programmatically) if my Simulink Block points to a user-defined library or a built-in one?

2 ビュー (過去 30 日間)
Robert
Robert 2017 年 11 月 13 日
I have a list of block names in a cell array and want to delete the entries that correspond to resolved links to built-in libraries.
>> blocks = {'my_model/Submatrix', 'my_model/special_sauce', 'my_model/Subsystem'};
>> get_param(blocks, 'ReferenceBlock')
ans =
'dspmtrx3/Submatrix'
'my_library/special_sauce'
''
This tells me that the first block references a built-in Submatrix routine, the second references my user-defined library, and the third is not a library-linked block. But only because I know dspmtrx3 is a built-in library. Since my use-case involves 10,000 blocks from a dozen or so libraries, I want a way to discern this programatically.
I can use bdroot to get the library filename and use which to see where it is located. This would tell me what I want to know (barring the possibility that my user-defined library is stored inside matlabroot, which I know is not the case for me and should never be the case); however, it feels like an awfully round-about way to get my answer. Is there some property of a Simulink block that would tell me this more directly?

  0 件のコメント

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by