How to check accepted input data types programatically

6 次查看(过去 30 天)
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!

回答(1 个)

Amit Dhakite
Amit Dhakite 2023-3-17
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

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by