Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#应用程序运行matlab时出错,使用cd输入参数过多_C#_.net_Matlab - Fatal编程技术网

c#应用程序运行matlab时出错,使用cd输入参数过多

c#应用程序运行matlab时出错,使用cd输入参数过多,c#,.net,matlab,C#,.net,Matlab,我希望从我的c#应用程序中运行一个matlab函数 下面是我的代码,我从上一个问题的链接中编辑了它。但是,代码不起作用 错误消息发生在matlab.Feval行上。尽管我的代码看起来与示例相同 An unhandled exception of type 'System.Runtime.InteropServices.ComException' occurred in mscorlib.dll. Additional information: Error using cd Too many i

我希望从我的c#应用程序中运行一个matlab函数

下面是我的代码,我从上一个问题的链接中编辑了它。但是,代码不起作用

错误消息发生在matlab.Feval行上。尽管我的代码看起来与示例相同

An unhandled exception of type 'System.Runtime.InteropServices.ComException' occurred in mscorlib.dll.

Additional information: Error using cd
Too many input arguements
代码

使用:

请注意
字符以括起matlab字符串


否则,路径中的空白字符会分割输入,并且
cd
认为它正在接收2个输入。

我猜matlab不喜欢非线性中的空格。尝试在没有空间的情况下转到另一条路径,看看是否有效。如果是这样的话,你就需要以某种方式逃离这个空间或其他东西。
static void Main(string[] args)
    {
        // create matlab instance
        MLApp.MLApp matlab = new MLApp.MLApp();
        matlab.Visible = 1;

        // change to the directory where the function is located
        matlab.Execute(@"cd G:\Shared\Folder\Matlab\Non Linear");

        // define the output
        object result = null;

        // call the matlab function upload_data
        //matlab.Feval("upload_data", 0, out result);
        matlab.Feval("upload_data_test", 1, out result, "DMS", "dsfd", 0);
        //[success] = upload_data_test(data_base, str_dir, b_return_data)

        // quit matlab
        matlab.Quit();
        releaseObject(matlab);            

        // display result
        object[] res = result as object[];

        Console.WriteLine(res[0]);
        Console.ReadLine();
    }
matlab.Execute(@"cd 'G:\Shared\Folder\Matlab\Non Linear'");