title: Matlab coder Non-constant expression or empty matrix
body: <p>I am trying to make a function made by Matlab transformed into MEX file to enhance execution speed of the function but the coder show the error: </p>
  
  <blockquote>
    <p>Non-constant expression or empty matrix. This expression must be
    constant because its value determines the size or class of some
    expression.</p>
  </blockquote>
  
  <p>The part of the code that causes the problem is </p>
  
  <pre><code>indx=mat==max(mat);
  nominees={acceptedB{indx,:}};
  </code></pre>
  
  <p>I also tried not to use logical indexing using </p>
  
  <pre><code>indx=find(mat==max(mat));
  </code></pre>
  
  <p>but the same error appeared.
  any idea how to solve this problem without affecting execution speed of the function ?</p>