www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimtablefiller/private/pGetTablesIdx.m

    function inds = pGetTablesIdx(obj, tables)
%PGETTABLESIDX Find index of tables
%
%   OUT = PGETTABLESIDX(OBJ) returns the position of all the tables in OBJ,
%   that is OUT = 1:length(OBJ.TABLES)
%
%   OUT = PGETTABLESIDX(OBJ, pTABS) finds the position of pTABS in the list
%   of the tables in OBJ. 

%   Copyright 2006 The MathWorks, Inc.

if nargin > 1

    % Ensure that the tables are specified as pointers
    if ~isa(tables, 'xregpointer')
        errmsg = 'pTABS must be an array of pointers to tables';
        error('mbc:cgoptimtablefiller:InvalidArgument', errmsg);
    end
    
    % Ensure that all the pointers can be located in the object
    inds = findptrs(tables, obj.tables);
    if ~all(inds)
        errmsg = 'Cannot find all tables in the table filler';
        error('mbc:cgoptimtablefiller:InvalidArgument', errmsg);
    end
else
    inds = 1:length(obj.tables);
end