當前位置:編程學習大全網 - 編程軟體 - C#中引用matlab的函數進行計算的問題,C#與MATLAB之間傳遞參數總是出錯,我用的erf函數,下面附有代碼,

C#中引用matlab的函數進行計算的問題,C#與MATLAB之間傳遞參數總是出錯,我用的erf函數,下面附有代碼,

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using MathWorks.MATLAB.NET.Arrays;//在MWArray.dll,最常用的

using MathWorks.MATLAB.NET.Utility;// 在MWArray.dll,最常用的

using erfc;//這個就是我們自己定義的,裏面有matlab函數

namespace erfccc

{

class Program

{

static void Main(string[] args)

{

erfc.Myclass E = new Myclass();

Console.WriteLine("輸入x的值:");

int x = Convert.ToInt32(Console.ReadLine());

MWArray[] result = E.erfc(1,(MWArray)x); //第壹個參數取決於妳的erfc有幾個返回參數

MWNumericArray r1 = (MWNumericArray)result [0];

double[,] location1 = (double[,])r1.ToArray(MWArrayComponent.Real);

Console.WriteLine(location1 [0,0].ToString());

}

}

}

  • 上一篇:易語言組合框,子菜單
  • 下一篇:位地址是什麽意思?
  • copyright 2024編程學習大全網