I am wondering how to retrieve the library block path that we use for block creation after the element has been created.
If we want to create a new Scope Block that can be found through the model browser in the following path: 'simulink/Sinks/Scope', we execute programmatically the following in the MATLAB console:
scope = add_block('simulink/Sinks/Scope','model/ScopeName');
to get the block type we can use:
scopeBlockType = get_param(scope, 'BlockType')
To my knowlege, there is no parameter we can ask to the recently created block to retrieve the original "simulink/Sinks/Scope" which is required for creation. For some use cases e.g. if we want to automate the creation extracting information from already existing blocks, this information would be indispensable.
What complicates things is that for some blocks the BlockType property does not match the name of the block on the path used for creation. For example, when we create a Stateflow Chart block, we call:
chart = add_block('sflib/Chart','model/MyChart');
which returns a different BlockType
chartBlockType = get_param(chart, 'BlockType')
This complicates when we search for blocks of a given type, which must be specified through the use of 'BlockType' as follows:
list = find_system(model, 'BlockType', 'SubSystem');
which returns blocks that have the same 'BlockType' property but could have been created with different block signatures (e.g. 'sflib/Chart' or 'simulink/Commonly Used Blocks/Subsystem'). To my knowledge, there is no way, other than naming conventions or block-specific properties, to tell them apart or to get the signature used for creation.
I have also tried the following without any success:
I would appreciate if you could tell me if I am missing a method or property which returns this information or to consider implementing this functionality.