www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/mbcremovedataloadingfcn.m

    function [OK] = mbcremovedataloadingfcn(index)
%MBCREMOVEDATALOADINGFCN Remove particular data loading function by index
%
%  OK = MBCREMOVEDATALOADINGFCN(INDEX) removes the data loading functions
%  defined in positions INDEX in the array of functions returned by
%  MBCGETDATALOADINGFCN
%  
%  Example usage:
%
%  OK = MBCREMOVEDATALOADINGFCN([2 3 4]) removes the second, third and
%  fourth checked-in data loading functions.
%  
%  See also MBCMODEL, MBCGETDATALOADINGFCN, MBCCHECKINDATALOADINGFCN.

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


% Get current Data Loading preferences
p = getpref(mbcprefs('mbc'), 'DataLoading');
% How many checked in functions
numFunctions = length(p.DataImportFunctions);
% Check that all indices passed in are valid
if ~all(ismember(index, 1:numFunctions))
    error(message('mbc:mbctools:InvalidArgument'));
end
% Remove the relevant functions
p.DataImportFunctions(index) = [];
% Get the current user preferences
currentPrefs = mbcprefs('mbc');
% Set the new loading functions
setpref(currentPrefs, 'DataLoading', p);
% Return true
OK = true;