⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 domask.m

📁 一些制作正交曲线网格的matlab源程序
💻 M
字号:
function theResult = domask(self, needsUpdate)% seagrid/domask -- Compute the "seagrid" mask.%  domask(self) computes the mask for self,%   a "seagrid" object.  Non-zero mask-values%   denote land; zeros denotes water. % Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.%  All Rights Reserved.%   Disclosure without explicit written consent from the%    copyright owner does not constitute publication. % Version of 10-May-1999 09:40:20.% Updated    14-Nov-2000 11:24:14.if nargout > 0, theResult = self; endif nargin < 1, help(mfilename), return, endif nargin < 2, needsUpdate = psget(self, 'itsNeedsUpdate'); endtheGridSize = psget(self, 'itsGridSize');theCoastline = findobj(gcf, 'Tag', 'coastline');if isempty(theCoastline), return, endcx = get(theCoastline, 'XData');cy = get(theCoastline, 'YData');theSpacedGrids = psget(self, 'itsSpacedGrids');u = theSpacedGrids{1};v = theSpacedGrids{2};u = interp2(u, 1);v = interp2(v, 1);utemp = u(2:2:end-1, 2:2:end-1);  % Grid-centers.vtemp = v(2:2:end-1, 2:2:end-1);useMexFile = psget(self, 'itUsesMexFile');hasMex = (exist('mexinside', 'file') == 3);theFcn = 'insidesafe';if hasMex & useMexFile, theFcn = 'mexinside'; endif needsUpdate	busy	f = find(~isfinite(cx) | ~isfinite(cy));	f = f(:).';	if ~any(f), f = [0 length(cx)+1]; end	if f(1) ~= 1, f = [0 f]; end	if f(end) ~= length(cx), f(end+1) = length(cx)+1; end	if isunix		shouldAlert = (prod(theGridSize) > 1000);	else		shouldAlert = (prod(theGridSize) > 100);	end	if shouldAlert		h = warndlg('Please wait ...', 'Computing Mask');		drawnow	end	theMask = zeros(size(utemp));	for i = 2:length(f)		g = find(theMask == 0);		if ~any(g), break, end		j = f(i-1)+1:f(i)-1;		if length(j) > 2			theMask(g) = feval(theFcn, utemp(g), vtemp(g), cx(j), cy(j));		end	end	if shouldAlert & ishandle(h), delete(h), end		theLand = ~~theMask;	theWater = ~theLand;		psset(self, 'itsMask', theMask)	psset(self, 'itsWater', theWater)	psset(self, 'itsLand', theLand)	idleelse	theMask = psget(self, 'itsMask');endtheFigure = ps(self);setsafe(0, 'CurrentFigure', theFigure)if nargout > 0, theResult = self; end

⌨️ 快捷键说明

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