.net - c# console application run matlab function -


i have code written in matlab wish call code c# console application.

i not require data returned matlab app (although if easy nice see).

there appears few options not sure best. speed not important automated task.

matlab has .net interface that's well-documented. need covered in call matlab function c# client article.

for simple matlab function, say:

function [x,y] = myfunc(a,b,c)  x = + b;  y = sprintf('hello %s',c);  

..it boils down creating mlapp , invoking feval method:

class program  {      static void main(string[] args)      {          // create matlab instance          mlapp.mlapp matlab = new mlapp.mlapp();           // change directory function located          matlab.execute(@"cd c:\temp\example");           // define output          object result = null;           // call matlab function myfunc         matlab.feval("myfunc", 2, out result, 3.14, 42.0, "world");           // display result          object[] res = result object[];           console.writeline(res[0]);          console.writeline(res[1]);          console.readline();      }  } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -