Error: Index in position 2 exceeds array bounds (must not exceed 155).

1 Ansicht (letzte 30 Tage)
Frederik Reese
Frederik Reese am 28 Jun. 2022
Hi,
I get this error: Index in position 2 exceeds array bounds (must not exceed 155). Why??
Thanks
for i= 1:length(FRI_10000_DOK_nonan)
Z1(i,:)= 1:155;
if isnan(Zeit_Flutende_10000_BA_nonan(i,:))== 1 | Zeit_Flutende_10000_BA_nonan(i,:)==0
Y_draw_10000_BA(i,[1:50])= nan;
FRI_HQ10000_draw_BA(i,[1:50])= nan;
else
Y_draw_10000_BA(i,:) = Z1(i,Zeit_Flutende_10000_BA_nonan(i,:):(Zeit_Flutende_10000_BA_nonan(i,:)+49)) ;
FRI_HQ10000_draw_BA(i,:) = FRI_10000_DOK_nonan(i,Zeit_Flutende_10000_BA_nonan(i,:))+slope_HQ10000_BA(i,:)*(Y_draw_10000_BA(i,:)-Y_draw_10000_BA(i,1)); % 10 samples before end point + slope = line
end
%FRI_HQ10000_draw_BA(FRI_HQ10000_draw_BA>1)=nan;
end
  1 Kommentar
KSSV
KSSV am 28 Jun. 2022
The mat files which you have uploaded and the variables given in the code, do not match. There are some undefined variables.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sai Charan Sampara
Sai Charan Sampara am 28 Jun. 2022
Bearbeitet: Sai Charan Sampara am 28 Jun. 2022
The only two places where there is a variable in 2nd index place is in these two lines.
Y_draw_10000_BA(i,:) = Z1(i,Zeit_Flutende_10000_BA_nonan(i,:):(Zeit_Flutende_10000_BA_nonan(i,:)+49)) ;
FRI_HQ10000_draw_BA(i,:) = FRI_10000_DOK_nonan(i,Zeit_Flutende_10000_BA_nonan(i,:))+slope_HQ10000_BA(i,:)*(Y_draw_10000_BA(i,:)-Y_draw_10000_BA(i,1));
So make sure that ,
Zeit_Flutende_10000_BA_nonan(i,:)+49 < size(Z1,2) and
Zeit_Flutende_10000_BA_nonan(i,:) < size(FRI_10000_DOK_nonan,2)

Kategorien

Mehr zu Matrix Indexing 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!

Translated by