I keep getting this error; Index in position 2 exceeds array bounds. Index must not exceed 1. Line 22

1 回表示 (過去 30 日間)
This is my code. I'm not sure what I'm doing wrong here:
FileName = 'Model/o3_surface_20180701000000.nc';
[Contents, Lat, Lon] = ReadFilePar(FileName);
NumHours = 5;
%% 2: Processing parameters
% ## provided by customer ##
RadLat = 30.2016;
RadLon = 24.8032;
RadO3 = 4.2653986e-08;
StartLat = 1;
NumLat = 400;
StartLon = 1;
NumLon = 700;
for idxTime = 1:NumHours
[HourlyData] = LoadDataparallel(FileName,Contents, idxTime, StartLat, NumLat, StartLon, NumLon);
[Data2Process, LatLon] = PrepareData(Lat,HourlyData, Lon);
%% 3: Pre-allocate output array memory
% the '-4' value is due to the analysis method resulting in fewer output
% values than the input array.
NumLocations = (NumLon - 4) * (NumLat - 4);
EnsembleVectorPar = zeros(NumLocations, NumHours); % pre-allocate memory
[EnsambleVectorPar] = Parallelanalysis(EnsembleValue, Num2Process, RadLat, RadLon, RadO3);
end
%% 10: Reshape ensemble values to Lat, lon, hour format%% Parallel Analysis
EnsembleVectorPar = reshape(EnsembleVectorPar, 696, 396, []);
fprintf('Total processing time for %i workers = %.2f s\n', PoolSize, sum(T3));
poolobj = gcp;
% attaching a file allows it to be available at each processor without
% passing the file each time.
  15 件のコメント
Cris LaPierre
Cris LaPierre 2022 年 11 月 4 日
Please copy and paste all the red text. Just knowing the line is not helpful. We need to see the full error message.
Walter Roberson
Walter Roberson 2022 年 11 月 4 日
What is size(03Data) ? What are the values of the other variables mentioned there?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by