From: FCIS mohammed on
I used to link C# with Matlab,

But sometimes I got this problem. which is the matlab function return to me wrong output in C# side

(i.e.
When calling matlab Function in Matlab

function bw = OstuThreshold(GrayImage)
level = graythresh(GrayImage);
bw = im2bw(GrayImage,level);
end

in gives the desired output in bw Buffer ( Binary image with 0s and 1s).

But when I call it inside visual studio 2008 , it returns Only one Color , which is white only. ( Binary image with 1s Only).

this problem happened to me more than once.. with other functions too..

Here is the C# code :

MWLogicalArray bw = (MWLogicalArray)MatlabClassObj.OstuThreshold((MWNumericArray)grayBuffer);

Boolean[,] BooleanImage = (Boolean[,])bw.ToArray(); // The Boolen Buffer has only // 1s Values

Any Help will be appreciated.