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 个评论

What is "x"? Do you mean Train instead or Test?
Yes thank a lot Guillaime
it is Train instead of x
cheers
@Tino: Although I do like Guillaume a lot, I want to insist, that I am Jan.
Not a problem Jan
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