From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
|
byVal/Input
パラメータとしてネイティブの ADE データ型 (double、integer
など) が使用できます。また、byRef/ref/output/return
パラメータには object
が使用できます。
[Visual Basic]
Dim inputData(100) As Double
Dim rnd As New Random(100)
Dim i As Integer
For i = 0 To 100
inputData(i) = rnd.NextDouble() * 100
Next i
' meanValue(return value) はオブジェクトとして、inputData は double の配列として宣言
Dim meanValue = AxCWStat1.Mean(inputData)
' acEstimate, dcEstimate (いずれの出力変数) は object として宣言
Dim acEstimate, dcEstimate
AxCWDSP1.ACDCEstimator(inputData, acEstimate, dcEstimate)
[CSharp]
double[]inputData = new double[100];
Random rnd = new Random(100);
for (int i=0;i<100;++i)
inputData[i] = rnd.NextDouble()*100;
// double 型にキャスト
double mean= (double)axCWStat1.Mean(inputData);
// ref 引数は object として宣言する。
// ref なので null に初期化する。
// object を 0 に初期化できない、つまり
// object acEstimate=0, dcEstimate=0
// は不正。この場合、引数を object ではなく整数型にマーシャリングしてしまうので、
//type mismatch 例外が投げられる。
object acEstimate=null, dcEstimate=null;
axCWDSP1.ACDCEstimator(inputData,ref acEstimate, ref dcEstimate);
return;
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll.
Additional information: Type mismatch.
|