在Simulink中枚举一个块的输入和输出

如何在Simulink中有问题地枚举块的输入和输出句柄?到目前为止,我已尝试使用以下内容,其中'sfunc'已设置为块句柄:
inports = get_param(sfunc, 'Inport')
outports = get_param(sfunc, 'Outport')
返回二维数组,其大小等于指定端口的数量。但是当我运行以下内容时(使用'inports'或'outports')
get_param(inports, 'Handle')
它声明数组必须是一个向量。我是以正确的方式来做这件事的吗?如果是这样,我如何将数组转换为向量?基本上我要做的是获取连接到块的线的句柄,以便稍后在用新的块替换当前块之后将它们链接起来。任何有关这方面的帮助将不胜感激。     
已邀请:
尝试使用参数PortHandles,这将为您提供一个包含Inport,Outport,EnablePort等字段的结构.Inport和Outport字段将是一个句柄数组,即端口数量的大小。
>> ph = get_param(sfunc, 'PortHandles')
>> inportHandles = ph.Inport;
% Get the 2nd input port handle
>> input_2 = inportHandles(2);
>> line = get_param(input_2, 'Line');
    

要回复问题请先登录注册