Error 1 exceed array bound

Hi
Please find my code below
when I run the code, I am getting the error find below
Will appreciate your help
Tino
dists = squeeze(sqrt(sum((Train - permute(Test,[3,2,1])).^2,2)));
k = 1;
[d,ind] = sort(dists);
ind_closest = ind(1:k);
x_closest = x(ind_closest,:);
I am getting the error
Index in position 1 exceeds array bounds (must not exceed 1).
Error in practice (line 18)
x_closest = x(ind_closest,:);

댓글 수: 5

Jan
Jan 2019년 5월 16일
What is "x"? Do you mean Train instead or Test?
Tino
Tino 2019년 5월 16일
Yes thank a lot Guillaime
it is Train instead of x
cheers
Jan
Jan 2019년 5월 16일
@Tino: Although I do like Guillaume a lot, I want to insist, that I am Jan.
Tino
Tino 2019년 5월 16일
Not a problem Jan
Jan
Jan 2019년 5월 16일
Okay, thanks a lot, Steven. :-)

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

답변 (1개)

aymane souani
aymane souani 2019년 5월 16일

0 개 추천

Hello.
I think that you should check your data in X.
You might exceed the range of your number of rows or that your x_closest hasn't the same size as x(ind_closest,:).

카테고리

도움말 센터File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품

릴리스

R2019a

태그

질문:

2019년 5월 16일

댓글:

Jan
2019년 5월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by