www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/cgvardiff.m
function [OKleft,SpareLeft] = cgvardiff(left,right) %CGVARDIFF Identifies the common variables in two sets of expressions % % [OKleft,SpareLeft] = cgvardiff(left,right) % each of left and right is either: % 1) an array of pointers to cgvalues, which are our "variables" % 2) a pointer to a cgexpression. we call getinports on, and % our "variables" are any cgvalues in these. % % OKleft contains those variables in "left" which are also in "right". % SpareLeft contains those variables in "left" which are NOT also in "right". % Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc. % First decompose left and right into their ddvariables if length(left)==1 && ~left.isddvariable left = left.getinports; end if length(right)==1 && ~right.isddvariable right = right.getinports; end left = cgindependentvars(unique(left)); right = cgindependentvars(unique(right)); NotInR = cgisindependentvars(left, right); OKleft = left(~NotInR); SpareLeft = left(NotInR);