title: compile the my own matlab function to be a C++ library
body: <p>In my main <code>matlab</code> function, some m functions written by myself and some built-in matlab functions are called. If I use the maltab compiler <code>mcc</code> to compile these called m functions to be a <code>C++</code> library, and also compile the main matlab function, is it possible that I could call this main function in my <code>C++</code> scripts ? Or how could I achieve this goal? Is it a must to convert the main <code>matlab</code> function to a <code>C++</code> function? Any help will be appreciated.</p>
  
  <p>Here is an example to explain my question more clearly:</p>
  
  <pre><code>function y = mymain(m,n)
       ...
       a = randn(m,n);
       b = find(a&gt;0);
       c = sqrt(b);
       d = myfun1(b);
       e = myfun2(c); % myfun1 and myfun2 are the subfunctions written by my self 
       ...
       % in myfun1 and myfun2, only the matlab build-in functions are called.
       % my goal is to get the point that a C++ main function could call this mymain
  </code></pre>