MATLAB: What is the function of the undocumented block parameter “SourceBlock” for certain blocks in Simulink 6.6 (R2007a)

blockreferencesimulinksource

For certain blocks I can query the "SourceBlock" property of the block. However, this property is not applicable for all blocks in the model. The function of this parameter and its use cases are not documented in the Simulink Documentation. When can I use this block parameter and when can I not?

Best Answer

A block which is a library block, and has an unresolved library link is represented by a Bad Link block in a Simulink block diagram. Such a "Bad Link" block has the block property "SourceBlock" which refers to the missing library block. For example, if you change the library name from lib1 to lib2 then the following would work.
bad_links = find_system(model, 'LinkStatus', 'Unresolved');
sources = get_param(bad_links, 'SourceBlock');
sources = strrep(sources, ['lib1/'], ['lib2/']);