www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoppoint/getdata.m

    function data = getdata(op, name)
% CGOPPOINT/GETDATA Get the data corresponding to a factor
%
% data = GETDATA(op, factor_name)
% factor_name is a string or a cell array of strings

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



if ~(ischar(name) | iscell(name))
    error(message('mbc:cgoppoint:InvalidArgument20', 'CGOPPOINT/GETDATA: Required factor must be specified as a', 'string, or cell array of strings'));
end
if iscell(name)
    inds = [];
    for i =1 :length(name)
        if ~(ischar(name{i}))
            error(message('mbc:cgoppoint:InvalidArgument21', 'CGOPPOINT/GETDATA: Required factor must be specified', 'as a string, or cell array of strings'));
        end
        inds = [inds findname(op, name{i})];
    end
else
    inds = findname(op, name);
end
if isempty(inds)
    error(message('mbc:cgoppoint:InvalidArgument22'));
end
data = op.data(:, inds);