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

조회 수: 1 (최근 30일)
Frederik Reese
Frederik Reese 2022년 6월 28일
편집: Sai Charan Sampara 2022년 6월 28일
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
KSSV
KSSV 2022년 6월 28일
The mat files which you have uploaded and the variables given in the code, do not match. There are some undefined variables.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sai Charan Sampara
Sai Charan Sampara 2022년 6월 28일
편집: Sai Charan Sampara 2022년 6월 28일
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)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by