Unexpected Behavior of MATLAB Builder

126 Views Asked by At

I've a MATLAB function which computes a histogram difference between two color histograms. I've converted it into a corresponding JAR file using MATLAB Builder.

Now, when I try to retrieve the value, it's giving some unexpected results. The same code when executed in MATLAB for the same arguments is giving a different answer than that given when using Java.

The difference between both answers is quite large, so, it cannot be neglected.

Code is at: https://gist.github.com/835910

Can any one tell me the reason why this is happening?

1

There are 1 best solutions below

0
On

The only thing that immediately jumps out at me is that you're returning a matrix. And in Java, matrices are stored row-major but in Matlab they are stored column major.

So: is the data your sending to Matlab column major compatible? And are you interpreting the answer (hist) as column major?

This is a bit of a shot in the dark...