www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/mbcdefaultprops.m

    function propcell = mbcdefaultprops(defcell, customcell)
%MBCDEFAULTPROPS Combine user-defined and default property-value pairs
%
%  PROPCELL = MBCDEFAULTPROPS(DEFCELL, CUSTOMCELL) combines the
%  property-value pairs in the cell arrays DEFCELL and CUSTOMCELL and
%  returns it in PROPCELL.  Where a property's value is defined in both the
%  defaults and the custom input, the custom value will be returned in the
%  combined cell array.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


customProps = customcell(1:2:end-1);
useDef = false(length(defcell)/2);

for n = 1:length(useDef)
    useDef(n) = ~any(strcmpi(defcell{2*n-1}, customProps));    
end
if any(useDef)
    useDef = [useDef;useDef];
    propcell = [defcell(useDef(:)'), customcell];
else
    propcell = customcell;
end