필터 지우기
필터 지우기

Index in position 1 exceeds array bounds (must not exceed 1) error for a function definition when I run a code in DDE-BIFTOOL

조회 수: 2 (최근 30일)
Hi there, I am working in DDEBIFTOOL and I am running a code to plot a bifurctaion diagram. When I hit run in the code, MATLAB gives me the error "Index in position 1 exceeds array bounds (must not exceed 1)" referencing the first line in the funciton defintion (as in bold below):
HollingTanner_rhsSB1c=@(xx,par)[...
(par(1)*xx(2,1)) + (par(1)*xx(2,2)*exp(-par(2)*par(4))) - (par(2)*xx(1,1));....
(par(1)*xx(2,2)*exp(-par(2)*par(4))) - (par(3)*xx(2,1))];
I have done loads of research on this error, but I just cannot see where the problem is in the defintio of this function, given that I have used this code for this funciton in other simulations and it works perfectly.
I am very grateful for any help!

답변 (1개)

Sourabh Kondapaka
Sourabh Kondapaka 2020년 9월 2일
Hi,
As you mentioned that the same function was working earlier as intended, I suspect the issue in your current use-case is with the input that is being passed.
It could be that the value that is being passed to the first parameter has only 1 row and inside the function the second row is being accessed, as follows , “xx(2,1)”
Below code is a much a simpler example which throws the same error as yours.
%% Has 1 row and 2 columns.
a = zeros(1,2);
%% Accessing the second row first index which is out of bounds.
disp(a(2,1));
Hence throws a similar error to yours:
Index in position 1 exceeds array bounds (must not exceed 1)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by