0
I am following Matlab's example在C#中運行,但因爲我是新來的C#,我想打印的System.Array prresult = new double[4];
結果這裏是使用MATLAB的C#代碼:C#調用MATLAB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1{
class Class1{
[STAThread]
static void Main(string[] args){
MLApp.MLAppClass matlab = new MLApp.MLAppClass();
System.Array pr = new double[4];
pr.SetValue(11,0);
pr.SetValue(12,1);
pr.SetValue(13,2);
pr.SetValue(14,3);
System.Array pi = new double[4];
pi.SetValue(1,0);
pi.SetValue(2,1);
pi.SetValue(3,2);
pi.SetValue(4,3);
matlab.PutFullMatrix("a", "base", pr, pi);
System.Array prresult = new double[4];
System.Array piresult = new double[4];
matlab.GetFullMatrix("a", "base", ref prresult, ref piresult);
}
}
}
我之前添加這些行和之後,如:
System.Array prresult = new double[4];
System.Array piresult = new double[4];
Console.Write(prresult);
Console.Write(piresult);
matlab.GetFullMatrix("a", "base", ref prresult, ref piresult);
Console.Write(prresult);
Console.Write(piresult);
我收到的控制檯:
System.Double[]System.Double[]System.Double[]System.Double[]
。 。 。
如何在控制檯上打印正確的結果?
項目是類型?... – cMinor 2011-03-16 01:03:15
它是「雙」的權利? – cMinor 2011-03-16 01:09:37
我已更正了代碼 – Max 2011-03-16 01:10:42