www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgslparser/cgdivexpr.m
function ptr = cgdivexpr(obj,b,blockname,Inputs) %CGDIVEXPR - parse a product block % % ptr = cgdivexpr(obj,b,blockname,Inputs) % returns a pointer to a cgdivexpr % Copyright 2007-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. % this can be a list of operations, or the number of inputs ops = get_param(b,'inputs'); numops = str2double(ops); if ~isnan(numops) ops = repmat('*',1,numops(1)); end [ops,ind]=sort(strtrim(ops)); if strcmp(ops,'*') ptr=Inputs{1}; else Inputs=Inputs(ind); %ops and neweqn is now either * or / and is in order mult_ind = strfind(ops,'*'); Top = [Inputs{mult_ind}]; div_ind = strfind(ops,'/'); Bottom = [Inputs{div_ind}]; % make a new cgdivexpr ptr = xregpointer(cgdivexpr(blockname,Top,Bottom)); obj.addToList( ptr, b); end