out
KeywordThis example shows how to call methods that
use an out
keyword in the argument list.
The output argument db2
in the following outTest
method
is modified by the out
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 | outTest | (netdoc.SampleOutTest this, |
Create an assembly from the SampleOutTest
code,
using instructions in Build a .NET Application for MATLAB Examples.
Create an asmpath
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