我必须使用MATLAB中的C#调用数学函数,并且结果以对象格式获得。我需要将其转换为双数组。这是我的代码。
// Create the MATLAB instance
MLApp.MLApp matlab = new MLApp.MLApp();
// Change to the directory where the function is located
matlab.Execute(@"cd c:\Injection");
// Define the output
object result = null;
double X = 1; double Y = 10; double Z = 1;
// Call the MATLAB function myfunc
matlab.Feval("besselzero", 1, out result, X, Y, Z);
// Display result
object[] res = new object[2];
res = result as object[];