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

📄 netcdf_install.m

📁 netcdf插件安装和.nc格式数据的读取,主要操作mexcdf53.dll和netcdf.dll文件,适于从事海洋和大气专业的的数据格式.作者在实际中用matlab处理了一些此类数据
💻 M
📖 第 1 页 / 共 5 页
字号:
% %% Version of 30-Jul-2001 15:45:20.%% Updated    30-Jul-2001 15:45:20.%%theResult = numel_default(varargin{:});fclose(fout);disp(' ## Installing: "subsasgn.m" (text)')fout = fopen('subsasgn.m', 'w');%function theResult = subsasgn(self, theStruct, other)%%% ncatt/subsasgn -- Overloaded "()" operator.%%  subsref(self, theStruct) processes the subscripting%%   operator () for self, an "ncatt" object referenced on%%   the lefthand side of an assignment, as in self(i:j)%%   = other, self(i:j:k) = other, or self(:) = other.%%% See also: ncatt/subsref.% %% Copyright (C) 1996 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 15:45:48.%%if nargin < 1, help(mfilename), return, end%%if length(theStruct) < 1   % Never happens.%   result = other;%   if nargout > 1%      theResult = result;%   else%      disp(result)%   end%   return%end%   %result = [];%%if isa(other, 'ncitem'), other = other(:); end%%theNetCDF = parent(parent(self));%theNCid = ncid(self);%theVarid = varid(self);%theAttname = name(self);%if strcmp(theAttname, 'FillValue')%   theAttname = '_Fillvalue';%   theAtttype = datatype(ncvar('', theNCid, -1, theVarid));%	[ignore, theAttlen, status] = ...%      	ncmex('attinq', theNCid, theVarid, theAttname);%else%	[theAtttype, theAttlen, status] = ...%      	ncmex('attinq', theNCid, theVarid, theAttname);%end%if status < 0, theAtttype = class(other); end%%theAttvalue = self(:);%if isstr(theAttvalue)   % Undo escaped-zeros, if any.%   theAttvalue = strrep(theAttvalue, '\0', setstr(0));%end%%theDatatype = datatype(self);%theTypelen = ncmex('typelen', theDatatype);%isUnsigned = unsigned(self);%%s = theStruct;%theType = s(1).type;%theSubs = s(1).subs;%s(1) = [];%%if isa(theSubs, 'cell'), theSubs = theSubs{1}; end%%switch theType%case '()'%   if isempty(other) & length(theSubs) == 1 & strcmp(theSubs{1}, ':')%      result = delete(self);   % Delete.%      if nargout >  0%         theResult = result;%      else%         disp(result)%      end%      return%   end%otherwise%end%%switch theType%case '()'   % Attribute data: self(...)%   switch theSubs%   case ':'%      if isstr(other), other = strrep(other, '\0', setstr(0)); end%      theAttvalue = other;%   otherwise%      if isstr(other), other = strrep(other, '\0', setstr(0)); end%      theAttvalue(theSubs) = other;%   end%   if isstr(theAttvalue)%      theAttvalue = strrep(theAttvalue, '\0', setstr(0));%   end%	if isUnsigned & prod(ncsize(self)) > 0%		nBits = 8*theTypelen;%		i = (theAttvalue >= 2^(nBits-1));%		theAttvalue(i) = theAttvalue(i) - 2^nBits;%	end%   status = ...%      ncmex('attput', theNCid, theVarid, theAttname, ...%                       theAtttype, -1, theAttvalue);%   if status < 0%      theNetCDF = redef(theNetCDF);%      status = ...%         ncmex('attput', theNCid, theVarid, theAttname, ...%                          theAtttype, -1, theAttvalue);%   end%   result = self;%otherwise%   warning([' ## Illegal syntax: "' theType '"'])%end%%if nargout > 0%   theResult = result;%else%   disp(theResult)%endfclose(fout);disp(' ## Installing: "subsref.m" (text)')fout = fopen('subsref.m', 'w');%function theResult = subsref(self, theStruct)%%% ncatt/subsref -- Overloaded "{}", ".", and "()" operators.%%  subsref(self, theStruct) processes the subscripting%%   operator () for self, an "ncatt" object referenced on%%   the righthand side of an assignment, such as in%%   result = self(...).%%% Also see: ncatt/subsasgn.% %% Copyright (C) 1996 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 15:45:48.%%if nargin < 1, help(mfilename), return, end%%if length(theStruct) < 1%   result = self;%   if nargout > 0%      theResult = result;%   else%      disp(theResult)%   end%   return%end%%result = [];%%theNCid = ncid(self);%theVarid = varid(self);%theAttname = name(self);%theDatatype = datatype(self);%theTypelen = ncmex('typelen', theDatatype);%isUnsigned = unsigned(self);%%if length(theStruct) == 1%   s = theStruct;%   theType = s(1).type;%   theSubs = s(1).subs;%   s(1) = [];%   if theNCid >= 0%      [result, status] = ...%			ncmex('attget', theNCid, theVarid, theAttname);%      if status >= 0 & isstr(result)%         result = strrep(result, setstr(0), '\0');%      end%   else%      result = self.itsAttvalue;%   end%   switch theType%   case '()'   % Attribute data: self(...)%      if isa(theSubs, 'cell'), theSubs = theSubs{1}; end%      switch class(theSubs)%      case 'char'%         switch theSubs%         case ':'%         otherwise%            warning(' ## Illegal syntax.')%         end%      case 'double'%         result = result(theSubs);%      otherwise%         warning([' ## Illegal syntax: "' theSubs '"'])%      end%		if isUnsigned & prod(size(result)) > 0%			result(result < 0) = 2^(8*theTypelen) + result(result < 0);%		end%   otherwise%      warning(' ## Illegal syntax.')%   end%else%   warning([' ## Illegal syntax: "' theType '"'])%end%%if nargout > 0%   theResult = result;%else%   disp(theResult)%endfclose(fout);disp(' ## Installing: "var.m" (text)')fout = fopen('var.m', 'w');%function theResult = var(self)%%% ncatt/var -- Variables associated with attributes of the same name.%%  var(self) returns a list of the ncvar objects that have an%%   attribute with the same name as self, an ncatt object.% %% 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 15:45:48.%%if nargin < 1, help(mfilename), return, end%%if nargout > 0, theResult = []; end%%[ndims, nvars, ngatts, recdim, status] = ...%   ncmex('inquire', ncid(self));%if status < 0, return, end%%count = 0;%result = cell(0, 0);%for i = 1:nvars%   varid = i - 1;%   [varname, vartype, varndims, vardims, varnatts, status] = ...%      ncmex('varinq', ncid(self), varid);%   if status >= 0%      nc = ncitem('', ncid(self));%      v = ncvar(varname, nc);%      a = att(ncvar(varname, nc));%      for j = 1:length(a)%         if strcmp(name(a{j}), name(self))%            count = count + 1;%            result{count} = v;%            break%         end%      end%   end%end%%if nargout > 0%   theResult = result;%  else%   for i = 1:length(result)%      disp(name(result{i}))%   end%endfclose(fout);disp(' ## Installing: "version.m" (text)')fout = fopen('version.m', 'w');%function version(self)%%% Version of 30-Apr-2003 11:16:19.%%helpdlg(help(mfilename), 'ncatt')fclose(fout);cd ('..')bund_setdir('@ncbrowser')disp(' ## Installing: "disp.m" (text)')fout = fopen('disp.m', 'w');%function disp(self)%%% disp -- Display self.%%  disp(self) displays self, an "ncbrowser" object.% %% 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 06-May-1997 13:39:24.%%if nargin < 1, help(mfilename), return, end%%disp(struct(self))fclose(fout);disp(' ## Installing: "display.m" (text)')fout = fopen('display.m', 'w');%function display(self)%%% display -- Display an ncbrowser object.%%  display(self) displays self, an ncbrowser object.% %% 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 06-May-1997 13:43:20.%%if nargin < 1, help(mfilename), return, end%%theName = inputname(1);%disp(' '), disp([theName ' =']), disp(' ')%disp(self)fclose(fout);disp(' ## Installing: "ncbclipboard.m" (text)')fout = fopen('ncbclipboard.m', 'w');%function theResult = NCBClipboard(self)%%% NCBrowser/NCBClipboard -- NetCDF Browser clipboard file name.%%  NCBClipboard(self) returns the full-path name of%%   the NetCDF Browser clipboard file.% %% 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 08-May-1997 10:54:11.%%if nargin < 1, help(mfilename), return, end%%if nargout > 0, theResult = ''; end%%w = which(mfilename);%if any(w)%   w(length(w)) = '';%   w = [w 'nc'];%end%%if nargout > 0%   theResult = w;%  else%   disp(w)%endfclose(fout);disp(' ## Installing: "ncbevent.m" (text)')fout = fopen('ncbevent.m', 'w');%function theResult = ncbevent(self, theEvent)%%% NCBrowser/Event -- Event handler.%%  NCBrowser/Event(self, 'theEvent') handles 'theEvent'%%   sent to self, an NCBrowser object, by the "gcbo".%%   TheEvent is usually the name of the callback.  Each%%   time this routine is called, the NetCDF file object%%   (class "netcdf") is assigned to the command-line%%   variable "nco", and the selected NetCDF item is%%   assigned to "nci".   The "ncb" variable is the%%   current "ncbrowser" object.  The "ncx" variable%%   holds the most recently extracted data.% %% 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 21-Apr-1997 09:23:56.%% Updated    27-Jul-2000 14:44:40.%%if nargin < 1, help(mfilename), return, end%if nargin < 2, theEvent = 'Callback'; end%%bluish = [0.25 1 1];%light_blue = [0.75 1 1];%yellow = [1 1 0];%yellowish = [1 1 0.5];%greenish = (bluish + yellow) ./ 2;%purplish = [0.75 0.75 1];%%theFigure = self.itSelf;%%busy(theFigure)%%assignin('base', 'ncb', self)%%% Get the current selections.%%theGCBO = gcbo;%if isempty(theGCBO)%	theGCBO = findobj(theFigure, 'Type', 'uicontrol', ...%					'Style', 'pushbutton', 'Tag', 'Catalog');%end%theDimname = '';%theVarname = '';%theAttname = '';%theConceptname = '';%theTypename = '';%theNCItem = [];%theNCDim = [];%theNCVar = [];%theNCAtt = [];%%theNetCDF = super(self);%%f = findobj(theFigure, 'Type', 'uicontrol', 'Tag', 'Dimensions');%theDimnames = get(f, 'String');%if ~iscell(theDimnames), theDimnames = {theDimnames}; end%theDimvalue = get(f, 'Value');%if any(theDimvalue)%   theDimname = theDimnames{theDimvalue};%   theDimPrefix = theDimname(1);%   if theDimPrefix == '*', theDimname(1) = ''; end   % Trouble with '*...'.%   if ~strcmp(theDimname, '-')%%		theNCDim = self(theDimname);%		theNCDim = ncsubsref(self, '()', {theDimname});%	end%end%theDimensions = f;%%f = findobj(theFigure, 'Type', 'uicontrol', 'Tag', 'Variables');%theVarnames = get(f, 'String');%if ~iscell(theVarnames), theVarnames = {theVarnames}; end%theVarvalue = get(f, 'Value');%if any(theVarvalue)%   theVarname = theVarnames{theVarvalue};%   theVarPrefix = theVarname(1);%   if theVarPrefix == '*', theVarname(1) = ''; end%   if ~strcmp(theVarname, '-')%%		theNCVar = self{theVarname};   % <== Release 11 Trouble.%		theNCVar = ncsubsref(self, '{}', {theVarname});%	end%end%theVariables = f;%%f = findobj(theFigure, 'Type', 'uicontrol', 'Tag', 'Attributes');%theAttnames = get(f, 'String');%if ~iscell(theAttnames), theAttnames = {theAttnames}; end%theAttvalue = get(f, 'Value');%if any(theAttvalue)%   theAttname = theAttnames{theAttvalue};%   theAttPrefix = theAttname(1);%   if theAttPrefix == '*', theAttname(1) = ''; end

⌨️ 快捷键说明

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