Borrar filtros
Borrar filtros

What kind of Simulink block is this?

4 visualizaciones (últimos 30 días)
K E
K E el 26 de Abr. de 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 comentarios
Walter Roberson
Walter Roberson el 26 de Abr. de 2012
R2012b has not been released yet??
K E
K E el 26 de Abr. de 2012
Sorry, I edited to say 2011b not 2012b.

Iniciar sesión para comentar.

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 26 de Abr. de 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 comentarios
K E
K E el 27 de Abr. de 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 el 30 de Abr. de 2012
Thanks for posting your complete solution, KE!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by