I keep getting this error; Index in position 2 exceeds array bounds. Index must not exceed 1. Line 22
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Cris LaPierre
am 4 Nov. 2022
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
am 4 Nov. 2022
What is size(03Data) ? What are the values of the other variables mentioned there?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Install Products finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!