title: Matlab returns null to .NET instead of .NET object
body: <p>I would like to call a Matlab function from a C# client. This Matlab function returns C# objects. But for some reason instead of the object, I get null returned. </p>
  
  <p>What I try:
  I have a .dll built in  C#/.NET which contains the definition of class <code>CalibrationCharacteristics</code> in a namespace <code>CalibrationAlgorithm</code>. In the simplest form it would look like this:</p>
  
  <pre><code>public class CalibrationCharacteristics
  {
      public bool OverAllPassed;
  
      public CalibrationCharacteristics()
      {
          OverAllPassed = true;
      }
  }
  </code></pre>
  
  <p>I have a Matlab Script which does the following using the built dll:</p>
  
  <pre><code>function t = testInterface(rawData)    
  
  NET.addAssembly('[long path here]\TestForMatlab.dll');
  t = CalibrationAlgorithm.CalibrationCharacteristics;
  t.OverAllPassed = false;
  </code></pre>
  
  <p>I am trying to run the Matlab function from .NET using (as described in the Mathworks documentation: <a href="https://ch.mathworks.com/help/matlab/matlab_external/call-matlab-function-from-c-client.html" rel="nofollow noreferrer">https://ch.mathworks.com/help/matlab/matlab_external/call-matlab-function-from-c-client.html</a>)</p>
  
  <pre><code>    matlab.Feval("testInterface", 1, out outObject, rawData);
  </code></pre>
  
  <p>But what when I run the program I get <code>null</code> for <code>outObject</code>.</p>
  
  <p>If I make the Matlab function simpler (e.g. just adding <code>t=1;</code> at the end) I get back what I expect (namely 1 in an object).</p>
  
  <p>Am I trying to something that will not work?</p>