Error using horzcat Dimensions of arrays being concatenated are not consistent.
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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]
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!