title: Running matlab codes in python
body: <p>I am following this link to run matlab code in python: <a href="https://stackoverflow.com/questions/46141631/running-matlab-using-python-gives-no-module-named-matlab-engine-error">Running Matlab using Python gives &#39;No module named matlab.engine&#39; error</a></p>
  
  <p>I am getting the error: </p>
  
  <pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python36\lib\site-packages\matlab\engine\matlabengine.py", line 71, in __call___stderr, feval=True).result()
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python36\lib\site-packages\matlab\engine\futureresult.py", line 67, in result
  return self.__future.result(timeout)
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python36\lib\site-packages\matlab\engine\fevalfuture.py", line 82, in result
  self._result = pythonengine.getFEvalResult(self._future,self._nargout, None,out=self._out, err=self._err)
  
  matlab.engine.EngineError: MATLAB function cannot be evaluated
  </code></pre>
  
  <p>I am using Python 3.6 windows 7, 64 bit
  Matlab R2018b version</p>
  
  <p>I have just written a simple function in matlab and saved the file as demo.m
  The code is here:</p>
  
  <pre><code> printk();
   function printk()
       fprintf(' Hello world!');
   end
  </code></pre>
  
  <p>and saved the file as demo.mat</p>
  
  <p>Python idle:</p>
  
  <pre><code>import matlab.engine
  eng = matlab.engine.start_matlab()
  eng.demo(nargout=0)
  </code></pre>
  
  <p>Can anyone please help. I need to migrate whole bunch of codes in python. Any other possible way would be appreciated. Thanks.</p>