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 CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by