title: run .exe file of c++ from matlab with change input value
body: <p>I have <code>a.exe</code> file that I got from compiling C++ code in Microsoft Visual Studio 2010. I tried to run the <code>a.exe</code> file from Matlab, but I put this file to work in loop with another  <code>.m</code> file written in Matlab.</p>
  
  <p>The idea is to run the <code>.m</code> file in Matlab inside a <code>for</code> loop .  First, the Matlab file works with the first value of the loop and after that runs <code>a.exe</code> file inside Matlab with the same value and so on. I used <code>sprintf</code> to generate string of input for <code>.exe</code> file as explained below:</p>
  
  <pre><code>wvl=0.4,
  
  for ii=1:100 wvl=0.4+i*0.01;
  </code></pre>
  
  <p>There are another part of Matlab code to do some calculations and prepare input data file for the C++ code:</p>
  
  <pre><code>str=sprinf('a.exe,%f',wvl);
  
  system (str);
  </code></pre>
  
  <p>I am already using the command line arguments in C++ code to run the executable file with different values:</p>
  
  <pre><code>int main(int argc, char *argv[]);
  
  wvl=atof ( argv[1]);
  cout &lt;&lt; "wvl=" &lt;&lt; wvl &lt;&lt; endl;
  </code></pre>
  
  <p>The value <code>wvl</code> mentioned above I would like to change after compiling the code.</p>
  
  <p>I don't know if the error is in the C++ code or in the Matlab code, because I got the wrong results.</p>