www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@RunTimePointer/pveceval.m

    function out = pveceval(obj, fcn, varargin)
%PVECEVAL Vectorized evaluation of pointers
%
%  OUT = PVECEVAL(P, func, varargin) Reutrns the first output argument from
%  func in a cell array with the same dimension as P.
%  PVECEVAL(P, func, varargin) Puts first output argument back on the heap
%  

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



% extract info 
inf = get(obj, {'info'});
np = numel(obj);

n=max(nargout,1);
data = cell(1,np);
for i=1:np
    % do function evaluations
    out = feval(fcn,inf{i},varargin{:});
    data{1,i} = out;
end


switch nargout
    case 0
        % put modified data back on heap
        set(obj, {'info'}, data(1,:));
        out = [];
    case 1
        out = reshape(data,size(obj));
end