title: Calling methods of C++ class in MEX from MATLAB
body: <p>I have a DLP kit which I need to control via MATLAB using a C++ API.</p>
  
  <p>Say, I have functions/methods using C/C++ for <code>{load_data, load_settings,display_data}</code> in a mex file named dlp_controller.cpp/.c.</p>
  
  <p>I know I can call <code>dlp_controller();</code> with MATLAB.</p>
  
  <p>Is there a way I can call the method of this mex from MATLAB directly?</p>
  
  <p>Say my dlp_controller.cpp mex looks as:</p>
  
  <pre><code>class dlp{ ... }
  dlp::dlp{ ... }
  dlp::load_data{ ... }
  dlp::load_settings{ ... }
  dlp::display_data{ ... }
  
  void mexFunction(int nlhs, mxArray *[],int nrhs, const mxArray *prhs[]{ ... }
  </code></pre>
  
  <p>Can I somehow call the methods like <code>dlp_controller.load_data</code> from MATLAB? NOTE: A workaround can be to send a variable to <code>dlp_controller</code> and call the function internally using that and the data passed.</p>