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

조회 수: 2 (최근 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 CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by