Main Content

Call .NET Methods WithoutKeyword

This example shows how to call methods that use anoutkeyword in the argument list.

The output argumentdb2in the followingmethod is modified by theoutkeyword.

using System; namespace netdoc { public class SampleOutTest { //test out keyword public void outTest(double db1, out double db2) { db1 = db1 * 2.35; db2 = db1; } } }

The function signature in MATLAB®is:

Return Type Name Arguments
double scalar db2 (netdoc.SampleOutTest this,
double scalar db1)

Create an assembly from theSampleOutTestcode, using instructions in Build a .NET Application for MATLAB Examples.

Create anasmpathvariable set to the full path to the DLL file,SampleOutTest.dll, created by your development tool. For example:

asmpath ='c:\work\Visual Studio 2012\Projects\SampleOutTest\SampleOutTest\bin\Debug\'; asmname ='SampleOutTest.dll';

Load the assembly.

asm = NET.addAssembly(fullfile(asmpath,asmname));

Call the method.

cls = netdoc.SampleOutTest; db3 = outTest(cls,6)
db3 = 14.1000

Related Examples

More About