MATLAB Builder NE (.NET Assembly) Data type question
Posted
by Brett
on Stack Overflow
See other posts from Stack Overflow
or by Brett
Published on 2010-03-30T00:00:55Z
Indexed on
2010/03/30
0:03 UTC
Read the original article
Hit count: 579
Hi coders,
I am using MATLAB Builder NE (MATLAB's integrated .NET assmebly 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.
Thank you, Brett
© Stack Overflow or respective owner