www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@factorselector3d/pCheckExclusivity.m
function pCheckExclusivity(obj, fixedInput) %PCHECKEXCLUSIVITY Ensure variable selections are exclusive % % PCHECKEXCLUSIVITY(OBJ, FIXEDINPUT) makes sure that variable selections % are exclusive if the SelectionType property is set to 'exclusive'. % FIXEDINPUT specifies which factor has just been changed by the user (and % therefore must not be changed by this method). % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. % Not worth doing anything unless we have at least three factors and % exclusive selection mode if length(obj.Factors) < 3 || isequal(obj.SelectionType, 'normal') return end % Fixed input to be the first popup if not specified if nargin < 2 fixedInput = 1; end % Number of factors nFactors = length(obj.Factors); % Factors to be altered alterInputs = setdiff(1:3, fixedInput); popup1 = i_getPopup(obj, alterInputs(1)); popup2 = i_getPopup(obj, alterInputs(2)); popupFixed = i_getPopup(obj, fixedInput); Val1 = get(popup1, 'Value'); Val2 = get(popup2, 'Value'); ValFixed = get(popupFixed, 'Value'); % Are any of the factors the same as the fixed factor if ValFixed == Val1 possValues = setdiff(1:nFactors, [Val1, Val2]); Val1 = possValues(1); set(popup1, 'Value', possValues(1)); end if ValFixed == Val2 possValues = setdiff(1:nFactors, [ValFixed, Val1]); set(popup2, 'Value', possValues(1)); end function popup = i_getPopup(obj, alterInput) if alterInput == 1 popup = obj.XFactorPopup; elseif alterInput == 2 popup = obj.YFactorPopup; else popup = obj.ZFactorPopup; end