Main Content

本页面提供的是上一版软件的文档。当前版本中已删除对应的英文页面。

ncdisp

在命令行窗口中显示 NetCDF 数据源内容

说明

示例

ncdisp(source) 在命令行窗口中以文本形式显示 NetCDF 数据源 source 中的所有组、维度、变量定义以及属性。

示例

ncdisp(source,location) 显示有关 location 指定的变量或组的信息。

示例

ncdisp(source,location,dispFormat)dispFormat 指定的格式显示 NetCDF 数据源内容。

示例

全部折叠

显示 NetCDF 文件示例 example.nc 的内容。

ncdisp('example.nc')
Source:
           matlabroot\toolbox\matlab\demos\example.nc
Format:
           netcdf4
Global Attributes:
           creation_date = '29-Mar-2010'
Dimensions:
           x = 50
           y = 50
           z = 5
Variables:
    avagadros_number
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       description = 'this variable has no dimensions'
    temperature     
           Size:       50x1
           Dimensions: x
           Datatype:   int16
           Attributes:
                       scale_factor = 1.8
                       add_offset   = 32
                       units        = 'degrees_fahrenheight'
    peaks           
           Size:       50x50
           Dimensions: x,y
           Datatype:   int16
           Attributes:
                       description = 'z = peaks(50);'
Groups:
    /grid1/
        Attributes:
                   description = 'This is a group attribute.'
        Dimensions:
                   x    = 360
                   y    = 180
                   time = 0     (UNLIMITED)
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16
    
    /grid2/
        Attributes:
                   description = 'This is another group attribute.'
        Dimensions:
                   x    = 360
                   y    = 180
                   time = 0     (UNLIMITED)
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16

MATLAB® 显示 example.nc 中的所有组、维度和变量定义。

显示文件 example.nc 中变量 peaks 的内容。

ncdisp('example.nc','peaks')
Source:
           matlabroot\toolbox\matlab\demos\example.nc
Format:
           netcdf4
Dimensions:
           x = 50
           y = 50
Variables:
    peaks
           Size:       50x50
           Dimensions: x,y
           Datatype:   int16
           Attributes:
                       description = 'z = peaks(50);'

只显示示例文件 example.nc 的组层次结构和变量定义。

ncdisp('example.nc','/','min')
Source:
           matlabroot\toolbox\matlab\demos\example.nc
Format:
           netcdf4
Variables:
    avagadros_number
           Size:       1x1
           Dimensions: 
           Datatype:   double
    temperature     
           Size:       50x1
           Dimensions: x
           Datatype:   int16
    peaks           
           Size:       50x50
           Dimensions: x,y
           Datatype:   int16
Groups:
    /grid1/
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16
    
    /grid2/
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16

输入参数

全部折叠

NetCDF 数据源的名称,指定为字符串标量或字符向量。source 参数可以是以下值之一:

  • 本地 NetCDF 源的路径

  • 远程 OPeNDAP NetCDF 数据源的 OPeNDAP URL

  • 远程 NetCDF 源的 HTTP URL,在 URL 的末尾附加 #mode=bytes 以支持字节范围读取

    注意

    字节范围读取比从其他来源读取要慢。有关字节范围读取的更多详细信息,请参阅 NetCDF 文档。

示例: "myNetCDFfile.nc"

NetCDF 文件中变量或组的位置,指定为字符向量或字符串标量。将 location 设置为 '/'(正斜杠)可以显示文件所有内容。

数据类型: char | string

显示格式,指定为下列值之一。

'full'显示组层次结构并带有维度、属性和变量定义
'min'显示组层次结构和变量定义

数据类型: char | string

局限性

  • 字节范围读取的性能比从其他来源读取要慢。

提示

  • 如果 source 是带有约束表达式的 OPeNDAP URL,请使用 ncdisp(source) 语法,不带任何其他输入参数。

版本历史记录

在 R2011a 中推出

全部展开