title: MATLAB - interaction between MATLAB 32bit and 64bit
body: <h1>PROBLEM</h1>
  
  <p>I have <strong>two tools</strong> written in MATLAB (I am not the author):</p>
  
  <ol>
  <li>the first allows me to <strong>retrieve some data from a SQL database</strong>, but it works only on <strong>MATLAB 64bit</strong> (I have MATLAB 2016b 64bit).</li>
  <li>the second <strong>uses the data retrieved from the first tool</strong> and, through
  a DLL compiled on a 32bit system, it gets some outputs. As said,
  this tool works <strong>only MATLAB 32bit</strong> (I have MATLAB 2013a 32bit).</li>
  </ol>
  
  <p>What I would like to do is:</p>
  
  <ol>
  <li>get the data from SQL, in MATLAB 64bit</li>
  <li>"send them" in some way to MATLAB 32bit</li>
  <li>run the tool on MATLAB 32bit</li>
  <li>"return" the outputs from MATLAB 32bit to MATLAB 64bit</li>
  </ol>
  
  <p>I know a solution may be found using IPC mechanisms, but I am not sure how to find them or how to use them in MATLAB. Does anyone ever worked with this kind of stuff?</p>
  
  <p>Looking into the MATLAB documentation I saw that it is possible to create a <strong>COM object</strong>, but I am not sure how to use it to run some functions in MATLAB 32bit.</p>
  
  <h1><strong>SOLUTION</strong></h1>
  
  <p>As suggested by @nekomatic below, everything works for me if I run the code in the way suggested, but excluding <code>-automatic</code> from the system command below.
  The final system command is in the form</p>
  
  <pre><code>system('"C:\path\to\R2013a\matlab.exe" -wait -r "mycommand; exit"')
  </code></pre>
  
  <p><code>mycommand</code> is a MATLAB script which loads the input file, it does something and then it saves an output file.</p>