Hello.. how to solve this error??

%Find the Euclidean distances
for j=1:lenCombF
distCombF=norm(combF2(combFpick(j),1:s2-2)-combF2(1,1:s2-2)); % utk kira EuD 2 dan 6
combF1(j,:)=[distCombF combFpick(j)];
end
Index exceeds matrix dimensions.
Error in QueryFunComb (line 46)
distCombF=norm(combF2(combFpick(j),1:s2-2)-combF2(1,1:s2-2)); % utk kira EuD 2 dan 6
Error in guiFV_fun (line 77)
[imCombF,combFrank, dR]=QueryFunComb(I,crop,combF,count);

Answers (1)

The error message is clear.
  • either combF2 is shorter than s2-2 in the 2nd dimension
  • or combFpick does not have j elements (or is this a function?)
  • or combF2 does not have combFpick(j) elements in the first dimension
  • or you have defined "norm" as a variable, such that the function is shadowed.
You will find the cause of the error with the debugger:
dbstop if error
After typing this in the command window, run you code again until it stops at the error. Now check the sizes and indices of the used variables. Split the line into parts and evaluate them in the command window.

Categories

Tags

Asked:

on 5 May 2017

Answered:

Jan
on 5 May 2017

Community Treasure Hunt

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

Start Hunting!