How to check accepted input data types programatically

1 visualización (últimos 30 días)
Bogdan Flueraru
Bogdan Flueraru el 10 de Feb. de 2023
Respondida: Amit Dhakite el 17 de Mzo. de 2023
Hi! Some simulink blocks only accept signals of certain data types as input (either by default or by setting something like an inport or a bus creator to a certain data type).
I know I can find the accepted data types in the matlab documentation. I'm interested to know if I can find these programatically, if there is a function/property that I can use that would give me a list of all the possible signal data types that a block or input port of a block.
Thanks!

Respuestas (1)

Amit Dhakite
Amit Dhakite el 17 de Mzo. de 2023
Hi Bogdan,
As per my understanding, you want to get the input data types a Simulink block can take, programmatically.
To get the details about any block, you have to focus it and write down the code shown below:
% For this case a gain block is considered
dlgParams = get_param(gcbh, 'DialogParameters');
disp(dlgParams.Gain.Validity.DataType);
For the gain block, the output is as follows:
Please note that the properties of different blocks may vary, not every block contains the "Gain" property.
For further information about the terms used above, kindly go through the following links:
  1. get_param() and 'DialogParameters': https://www.mathworks.com/help/simulink/slref/get_param.html
  2. gcbh: https://www.mathworks.com/help/simulink/slref/gcbh.html

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by