I am using MATLAB Builder NE (MATLAB's integrated .NET assembly builder), but I am having an issue with data types.
I have compiled a small, very simple, function in MATLAB and build it for .NET. I am able to call the namespace and even the function just fine. However, my function returns a value, and MATLAB defaults to returning it as an object[]
data type. However, I know that the value is an integer, but I can't figure out how to cast it.
My MATLAB function looks like this:
function addValue = Myfunction(value1, value2)
addValue=value1+value2;
end
Pretty simple right?
And then in .NET I can call it as:
xClass.addValue (1, 3, 4);
where xClass is the name of the MATLAB built class but when I try:
int x = xClass.addValue (1, 3, 4);
C# errors out. Typical .NET casting (int) doesn't work. The compiler states it cannot convert object[] to int.
Does anyone have experience with the .NET builder in MATLAB that can help me with this? It is really throwing me for a loop. I have scanned through most of the MATLAB BUILDER doc (484 pages!) with zero help.