フィルターのクリア

Error using horzcat Dimensions of arrays being concatenated are not consistent.

3 ビュー (過去 30 日間)
BN
BN 2022 年 11 月 7 日
編集済み: BN 2022 年 11 月 9 日
Dear all,
I want to read the variable “tref” for desired latitude and longitude (which I index them), 24th M, 4th L, and all S from a netcdf file but it was not successful. The error is:
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Here are the results of the ncdisp()
Source:
http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/.NCEP-CFSv2/.HINDCAST/.MONTHLY/tref/1+index/.tref/tref/tref/dods
Format:
classic
Global Attributes:
Conventions = 'IRIDL'
Dimensions:
L = 10
M = 24
S = 348
X = 360
Y = 181
Variables:
M
Size: 24x1
Dimensions: M
Datatype: single
Attributes:
standard_name = 'realization'
long_name = 'Ensemble Member'
pointwidth = 1
gridtype = 0
units = 'unitless'
X
Size: 360x1
Dimensions: X
Datatype: single
Attributes:
standard_name = 'longitude'
pointwidth = 1
gridtype = 1
units = 'degree_east'
L
Size: 10x1
Dimensions: L
Datatype: single
Attributes:
standard_name = 'forecast_period'
long_name = 'Lead'
pointwidth = 1
gridtype = 0
units = 'months'
S
Size: 348x1
Dimensions: S
Datatype: single
Attributes:
standard_name = 'forecast_reference_time'
long_name = 'Forecast Start Time'
pointwidth = 0
calendar = '360'
gridtype = 0
units = 'months since 1960-01-01'
Y
Size: 181x1
Dimensions: Y
Datatype: single
Attributes:
standard_name = 'latitude'
pointwidth = 1
gridtype = 0
units = 'degree_north'
tref
Size: 360x181x24x10x348
Dimensions: X,Y,M,L,S
Datatype: single
Attributes:
pointwidth = 0
standard_name = 'air_temperature'
PTVersion = 2
long_name = 'Reference Temperature'
process = 'Spectral Statistical Interpolation (SSI) analysis from "Final" run.'
PDS_TimeRange = 3
gribNumBits = 21
center = 'US Weather Service - National Met. Center'
grib_name = 'TMP'
gribcenter = 7
scale_min = 206.4713
gribparam = 11
scale_max = 315.4577
GRIBgridcode = 3
gribleveltype = 105
gribfield = 1
units = 'Kelvin_scale'
Can you help me with this issue, please?
Thank you.

採用された回答

Maik
Maik 2022 年 11 月 7 日
That error can be overcome if you use transpose as vectors of different dimensions can be concatenated horizontally.
Here your ind_lat is 21x1 and ind_lon is 17x1
ind_lat = ones(21,1);
ind_lon = ones(17,1);
% Will give error
% horz_cat = [ind_lat ind_lon 24 4 inf]
% take transpose and do the concatenation
horz_cat = [ind_lat' ind_lon' 24 4 inf]
horz_cat = 1×41
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by