Call .NET Methods Without
Keyword
This example shows how to call methods that use anout
keyword in the argument list.
The output argumentdb2
in the following出
method is modified by theout
keyword.
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, |
Create an assembly from theSampleOutTest
code, using instructions in Build a .NET Application for MATLAB Examples.
Create anasmpath
variable 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