.net - c# application running matlab error using cd too many input arguments -
i looking run matlab function c# application.
my code below, edited link matlab example previous question on here. code not working.
the error message happens on matlab.feval line. although code looks same example.
an unhandled exception of type 'system.runtime.interopservices.comexception' occurred in mscorlib.dll. additional information: error using cd many input arguements
code
static void main(string[] args) { // create matlab instance mlapp.mlapp matlab = new mlapp.mlapp(); matlab.visible = 1; // change directory function located matlab.execute(@"cd g:\shared\folder\matlab\non linear"); // define output object result = null; // call 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 object[]; console.writeline(res[0]); console.readline(); }
use:
matlab.execute(@"cd 'g:\shared\folder\matlab\non linear'");
note '
character enclose matlab string.
otherwise whitespace character in path split input , cd
thinks receiving 2 inputs.
Comments
Post a Comment