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

3 次查看(过去 30 天)
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