How to check accepted input data types programatically

1 view (last 30 days)
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!

Answers (1)

Amit Dhakite
Amit Dhakite on 17 Mar 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

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!