how can i solve this error: "index exceeds matrix dimensions"

i am trying the code from file exchange but getting is error: Index exceeds matrix dimensions. Error in Zernikmoment
Product = p(x,y).*Rad.*exp(-1i*m*Theta);
Error in Zernikmain
[mom, amplitude, angle] = Zernikmoment(BW2,4,0);
help me solving this error

3 Comments

We can't tell from only that and you don't even say which FEX code.
The first expression p might be an array but x,y are while not illegal, somewhat unusual variable names for array indices; sure it isn't a missing function?
In the second, it's pretty clear that Zernikmoment(BW2,4,0) is being interpreted as an array reference instead of a function which would tend to indicate you either haven downloaded the full submission or got it installed in a location on the Matlab path so all the m-files are being found the submission needs.
They included a link to the FEX code.
Ah...it had scrolled off the screen...

Sign in to comment.

 Accepted Answer

The submission includes Zernik_main but not Zernikmain (the file name in your message), and the Zernik_main does not include that line. We can conclude that your Zernikmain is not the same as the code they posted with a similar file name.
Zernikmoment assumes that it is being passed a square 2D matrix, p, and your code is violating that assumption so it is getting an index out of range.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 1 Jul 2018

Commented:

dpb
on 1 Jul 2018

Community Treasure Hunt

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

Start Hunting!