tncbig.m

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

M
43
字号
function tncbig(nBytes)

% tncbig -- Test allowed size of file.
%  tncbig(nBytes) creates a NetCDF file, then
%   an array of nBytes.  On Macintosh and PCWIN,
%   we have long had difficulty getting beyond
%   about 16K bytes, far too small for real work.
%   This has forced us to create larger files
%   on Unix machines.  Once created, such files
%   work on the smaller machines just fine.
 
% Copyright (C) 2000 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 23-Feb-2000 08:43:12.
% Updated    23-Feb-2000 09:00:51.

if nargin < 1, nBytes = 2^16; help(mfilename), end
if ischar(nBytes), nBytes = eval(nBytes); end

theFilename = [mfilename '.nc'];

n = 0;

while n < nBytes
	n = n + 1000;
	disp([' ## n: ' int2str(n)])
	nc = netcdf(theFilename, 'clobber');
	nc('index') = n;
	nc{'x'} = ncbyte('index');
	x = nc{'x'};
	x(:) = zeros(1, n);
	status = close(nc);
	delete(theFilename)
	if ~isequal(status, [])
		disp(' ')
		disp([' ## Unable to close file on ' computer '.'])
		break
	end
end

⌨️ 快捷键说明

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