How do I query the data type of every input and output port in a Simulink model?
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
Risposta accettata
MathWorks Support Team
il 16 Giu 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'')'])
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Model, Block, and Port Callbacks in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!