Clear Filters
Clear Filters

get Simulink block libinfo in find_system

19 views (last 30 days)
Craig
Craig on 30 Jul 2024 at 15:54
Commented: Craig on 30 Jul 2024 at 17:01
The 'Library' and 'ReferenceBlock' info from 'libinfo' is very useful, but 'libinfo' does not return as many blocks as find_system. In the case I am working on, find_system returns about 500 more blocks than libinfo. However, none of the block properties appear to be 'Library' or 'ReferenceBlock'. Is there anyway to obtain this? I use get(get_param(handlesReturnedByFind_System, 'handle')) to get block parameters.
Thanks is advance

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 30 Jul 2024 at 16:33
Edited: Fangjun Jiang on 30 Jul 2024 at 16:44
'ReferenceBlock' is a block property. 'Library' is not. You are probably looking for 'LinkStatus'.
model='f14';
open_system(model)
b=find_system(model,'FindAll','on','type','block','LinkStatus','resolved')
get_param(b,'ReferenceBlock')
ans =
'simulink/Sources/Band-Limited
White Noise'
>> lib=libinfo(model)
lib =
struct with fields:
Block: 'f14/Dryden Wind↵Gust Models/Band-Limited↵White Noise'
Library: 'simulink'
ReferenceBlock: 'simulink/Sources/Band-Limited↵White Noise'
LinkStatus: 'resolved'
If you are asking, in the returned info of libinfo(), where does that 'Library' info come from?
then, it is the file name (or library name) of the library block specified in 'ReferenceBlock'.
>> bdroot(lib.ReferenceBlock)
ans =
'simulink'

More Answers (0)

Categories

Find more on Simulink Environment Customization in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!