How do I query the data type of every input and output port in a Simulink model?

15 Ansichten (letzte 30 Tage)
When I select Port data types from the Format menu of a Simulink model, I can see the data type of every input and output port in this model. I would like to query these data types from command line or a script, and I also want to be able to do this using a generic model name such as gcs.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 16 Jun. 2010
Note that in order to query the data type, you need to compile the model first. Try the following example:
vdp
% open the model
vdp([],[],[],'compile');
% compile the model
h = get_param('vdp/Mu','Porthandles');
% get the port handles
get_param(h.Outport,'CompiledPortDataType')
% get the output port data type
vdp([],[],[],'term')
% terminate the compilation
For a generic model name such as 'gcs', consider using the EVAL function. Here is an example:
vdp
eval([gcs,'([],[],[],''compile'');'])
h = get_param('vdp/Mu','Porthandles');
get_param(h.Outport,'CompiledPortDataType')
eval([gcs,'([],[],[],''term'')'])

Weitere Antworten (0)

Kategorien

Mehr zu Model, Block, and Port Callbacks finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by