title: Calling Matlab from C# using COM object
body: <p>I'm trying to make a simple C# GUI that uses Matlab for its processing. I'm trying to use the Matlab application COM object for communication but am getting the following error during allocation:</p>
  
  <p>An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in cSharpCallsMATLAB.exe</p>
  
  <p>Additional information: Retrieving the COM class factory for component with CLSID {491B6189-7E9D-43F4-A7DE-C062DF7B326E} failed due to the following error: 80080005.</p>
  
  <p>Earlier I create the necessary object:</p>
  
  <p>private MLApp.MLAppClass ml;</p>
  
  <p>and assign it in the form constructor:</p>
  
  <p>ml = new MLApp.MLAppClass();</p>
  
  <p>and the program hangs on that line and returns an error after about 5 seconds.</p>
  
  <p>I've looked around but can't seem to fix this problem.  Does anyone have any advice on how to get C# to successfully connect to Matlab?</p>
  
  <p>Thanks!</p>