www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgslparser/cgsubexpr.m
function ptr = cgsubexpr(obj,b,blockname,Inputs) %CGPARSESUM - A CAGE Simulink parse function % % PTR = cgsubexpr(blockHandle,blockName,lines) % % Copyright 2007-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. ops = get_param(b,'inputs'); numops=str2double(ops); if ~isnan(numops) ops=repmat('+',1,numops(1)); end ops = strtrim(strrep(ops,'|','')); [ops,ind]=sort(ops); Inputs= Inputs(ind); %ops and neweqn is now either + or - and is in order add_ind = strfind(ops,'+'); Left = [Inputs{add_ind}]; sub_ind = strfind(ops,'-'); Right = [Inputs{sub_ind}]; ptr = xregpointer(cgsubexpr(blockname,Left,Right)); obj.addToList(ptr,b);