How do you call a C# function with overloaded return arguments from MATLAB?

Suppose I have the following code in C#:
public class MyClass
{
public void MyFunction(out string str)
{
str = "Hello";
}
public void MyFunction(out int a)
{
a = 5;
}
}
Suppose I then want to call this function from MATLAB:
>>NET.addAssembly('MyCSharpDll.dll');
>>obj = myNamespace.MyClass();
>>number = MyFunction(obj);
The last call is ambiguous. I get this C# situation in an API from a third party. How can I tell matlab to call MyFunction with the return type I want?

Answers (0)

Asked:

on 8 Jul 2014

Community Treasure Hunt

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

Start Hunting!