1 / 2
文档名称:

读取和写入nc文件.docx

格式:docx   大小:15KB   页数:2页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

读取和写入nc文件.docx

上传人:乘风破浪 2018/10/30 文件大小:15 KB

下载得到文件列表

读取和写入nc文件.docx

文档介绍

文档介绍:matlab读取和写入nc格式数据用到的几个函数(2013-04-19 11:39:01)转载▼
分类: Vapor
读取nc:
fname=’nc文件路径’。
(fname,'NC_NOWRITE');%打开文件
(fid,'varname');%返回各变量的id
(fid,vid);%根据ID读出数据
(fid);
例:
fname='F:\adcirc\tide\tide_OBC\four_tide\new_grd\huibao\27to29\'
(fname,'NC_NOWRITE');%´ò¿ªÎļþ
(fid,'lon');%·µ»Ø¸÷±äÁ¿µÄid
(fid,vid);%¸ù¾ÝID¶Á³öÊý¾Ý
(fid);
写入nc:
使用matlab原生支持命令创建nc文件范例

cid = (filename, mode);
mode:
'NC_NOCLOBBER': Prevent overwriting of existing file with the same name.
'NC_SHARE': Allow synchronous file updates.
'NC_64BIT_OFFSET': Allow easier creation of files and variables which are larger than two gigabytes.
例如:ncid = ('','NC_NOCLOBBER');

dimid = (ncid,dimname,dimlen);
例如:
dimidx = (ncid,'lon',10);
dimidy = (ncid,'lat',10);
3