www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@xregpointer/parrayeval.m
function varargout = parrayeval(p, varargin) %PARRAYEVAL Evaluates a function for a set of pointers % % [OUT1, OUT2, ...] = PARRAYEVAL(PTR, FCN, INPUTARGS, OUTTYPE) evaluates % the function FCN over the pointer array PTR. Additional input arguments % for FCN are specified by the cell array INPUTARGS which has one cell for % each input to FCN. The output types for the function returns can be % specified by function handles in OUTTYPE. The outputs are a set of % arrays the same size as PTR, one array for each output requested from % FCN. % % Input Specification % =================== % Each cell of INPUTARGS must contain either a cell array the same size as % the pointer array, a single cell or not be a cell. Input arguments that % are not cells or are single cells are "scalar expanded": they (or their % contents) are passed in to each function evaluation. Input arguments % that are a cell array are referenced and the corresponding cell's % contents are passed to each function evaluation. % % If you need to pass a cell array as an argument to each evaluation, you % should wrap this in another cell so that the method knows that that cell % contents should be scalar expanded. % % Output Specification % ==================== % The output arrays can be either specified as a particular type, or left % to be a cell array containment of the outputs. Outputs types are % defined by specifying a cell array of function handles, one for each % output. Each function handle is called in turn with a dimension vector % as input in order to initialise an output array. If a cell contains an % empty matrix, this specifies that the outputs should be captured and put % into separate cells of a cell array. % % For convenience, there is a set of methods that generate function % handles for all of the common types. These methods are: mbcdouble, % mbcuint32, mbcuint8, mbclogical, mbccell, mbcpointer. These methods can % also be used directly to produce a typed array when you need one. % % Example: % % >> p = repmat(xregpointer(cgvariable), 2,4); % >> parrayeval(p, @getvalue, mbcdouble) % % ans = % % 0 0 0 0 % 0 0 0 0 % Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc. hObjects = HeapManager(1, p.ptr); [varargout{1:nargout}] = mbccellarrayeval(hObjects, varargin{:});