What kind of Simulink block is this?

4 views (last 30 days)
In a Simulink model, I am trying to identify what kind of block one of the blocks is. When I click on the block, a mfile opens up for editing, but
get_param(gcb,'BlockType')
returns 'SubSystem'. Seems wrong since a Subsystem Block is supposed to contain a block diagram. This block contains MATLAB code, so it seems to be one of 3 kinds of custom blocks: Fcn, Interpreted MATLAB Function, or MATLAB Function block. (1) What call to get_param tells exactly what kind of block this is, i.e. 'Interpreted MATLAB Function'? I want the block name that would be used in the documentation.
I have R2011b, but in earlier releases it seems these blocks had different names: Fcn, Embedded MATLAB Function, and MATLAB Fcn. In R2011b (2) was the Embedded MATLAB Function block renamed Interpreted MATLAB Function? I assume that the MATLAB Fnc block was renamed MATLAB Function Block, but let me know if that is wrong.
  2 Comments
Walter Roberson
Walter Roberson on 26 Apr 2012
R2012b has not been released yet??
K E
K E on 26 Apr 2012
Sorry, I edited to say 2011b not 2012b.

Sign in to comment.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 26 Apr 2012
Actually, the MATLAB Function block has been renamed to Interpreted MATLAB Function block; and the Embedded MATLAB Function block has been renamed to MATLAB Function block.
Here are the conditions you can use to perform your check:
  1. BlockType=='MATLABFcn' for "Interpreted MATLAB Function" block
  2. BlockType=='Subsystem' && MaskType=='Stateflow' for "(Embedded) MATLAB Function" block
  3. BlockType=='Fcn' for "Fcn" block.
  2 Comments
K E
K E on 27 Apr 2012
Thanks so much. In case it helps someone else trying to identify a block in order to look it up in the documentation:
1) Get an alphabetized list of *all* the block parameters, which might help identify the block:
orderfields(get_param(gcb, 'ObjectParameters'))
2) Block-specific properties for user-defined functions like the MATLAB Function Block are listed in http://www.mathworks.com/help/toolbox/simulink/slref/f23-20073.html#userdefinedfcns_lib_blkparams . For other kinds of blocks, http://www.mathworks.com/help/toolbox/simulink/slref/f23-30749.html
Kaustubha Govind
Kaustubha Govind on 30 Apr 2012
Thanks for posting your complete solution, KE!

Sign in to comment.

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!