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

1 vue (au cours des 30 derniers jours)
Frederik Reese
Frederik Reese le 28 Juin 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 commentaire
KSSV
KSSV le 28 Juin 2022
The mat files which you have uploaded and the variables given in the code, do not match. There are some undefined variables.

Connectez-vous pour commenter.

Réponses (1)

Sai Charan Sampara
Sai Charan Sampara le 28 Juin 2022
Modifié(e) : Sai Charan Sampara le 28 Juin 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)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by