How do I query the data type of every input and output port in a Simulink model?
17 次查看(过去 30 天)
显示 更早的评论
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.
采纳的回答
MathWorks Support Team
2010-6-16
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model, Block, and Port Callbacks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!