feval.m

来自「MATLAB中读写、处理科学数据文件格式NETCDF的程序」· M 代码 · 共 40 行

M
40
字号
function varargout = feval(varargin)

% ncitem/feval -- feval() for an ncitem object.
%  [...] = feval('theFcn', ...) applies 'theFcn' function to the
%   argument list.  All "ncitem" arguments are dereferenced to
%   their corresponding numerical contents.  The stored NetCDF
%   contents themselves are not affected.

% Copyright (C) 1997 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 07-Aug-1997 09:48:11.

if nargin < 1, help(mfilename), return, end

% De-reference the ncitem data.

for i = 2:length(varargin)
   switch ncclass(varargin{i})
   case {'ncdim', 'ncvar', 'ncatt', 'ncrec'}
      varargin{i} = varargin{i}(:);   % Whole data.
   otherwise
   end
end

% Allocate output objects.

varargout = cell(1, min(nargout, 1));
for i = 1:length(varargout), varargout{i} = []; end

% Evaluate the function.

theFcn = varargin{1};
trystr = 'varargout{:} = feval(varargin{:});';
catchstr = ['disp('' ## ' mfilename ' failure while trying: ' ...
         theFcn '(...)'')'];
eval(trystr, catchstr);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?