Reputation: 868
I want to utilize the optimization toolbox of MATLAB, namely the genetic algorithm.
But my function is an executible, which I wrote in C, which takes a text file as input. In this input file the variables can be set. So I want MATLAB to modify this text file, run the executible, and take the result in an iteration. Is that possible?
Upvotes: 2
Views: 838
Reputation: 1
You can run *.exe
files with the !
command.
Create loop in MATLAB where you will write something to *.txt
, then run the C program with !name.exe
, and read results in iterations.
Upvotes: 0
Reputation: 83407
You can call C, C++, or FORTRAN code in MATLAB by compiling your code into a MATLAB Executable called a MEX-file : http://www.mathworks.com/support/tech-notes/1600/1622.html
Then you would have to call this MEX-file in your fitness function.
Upvotes: 0