www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgprojconnections/canReplace.m
function [repOK,indA]= canReplace(ProjA,ProjB,indB,ReplaceNames) %CANREPLACE check whether items in B can replace items in % % [repOK,indA]= canReplace(ProjA,ProjB,indB) % Copyright 2005 The MathWorks, Inc. if nargin<4 ReplaceNames= ProjB.Names(indB); end % find items which exist in A [OKA,indA]= ismember(ReplaceNames,ProjA.Names); % only replace models and variables for now ReplaceTypes= {'Model','Variable','Feature','Table','Normalizer'}; N= length(indB); repOK= false(1,N); for i=1:N if OKA(i) a= indA(i); b= indB(i); repOK(i)= ProjB.IsMajorItem(b) && ... strcmp(ProjA.Type{a},ProjB.Type{b}) && ... ismember(ProjA.Type{a},ReplaceTypes); % can replace same types % should replace - other conditions??? if repOK(i) repOK(i) = canReplace( ProjA.pData(a).info,ProjB.pData(b).info ); end end end