Filter löschen
Filter löschen

What kind of Simulink block is this?

4 Ansichten (letzte 30 Tage)
K E
K E am 26 Apr. 2012
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 Kommentare
Walter Roberson
Walter Roberson am 26 Apr. 2012
R2012b has not been released yet??
K E
K E am 26 Apr. 2012
Sorry, I edited to say 2011b not 2012b.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kaustubha Govind
Kaustubha Govind am 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 Kommentare
K E
K E am 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 am 30 Apr. 2012
Thanks for posting your complete solution, KE!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by