What kind of Simulink block is this?

4 ビュー (過去 30 日間)
K E
K E 2012 年 4 月 26 日
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 件のコメント
Walter Roberson
Walter Roberson 2012 年 4 月 26 日
R2012b has not been released yet??
K E
K E 2012 年 4 月 26 日
Sorry, I edited to say 2011b not 2012b.

サインインしてコメントする。

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 4 月 26 日
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 件のコメント
K E
K E 2012 年 4 月 27 日
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 2012 年 4 月 30 日
Thanks for posting your complete solution, KE!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by