mrkrd / matlab_wrapper

Easy to use MATLAB wrapper for Python
GNU General Public License v3.0
78 stars 23 forks source link

I have to rename the m file or the run result would be the result before #27

Closed FLOWERCLOUD closed 6 years ago

FLOWERCLOUD commented 6 years ago

Thanks for your great job! But I face some issue when I run your code. I don't know if it is a bug , every time I change the content in the m file ,I have to rename the m file. if not ,the result I run in python would be the same as what I get before I change the content in the m file.

for example:

if name == 'main':

matlab = matlab_wrapper.MatlabSession()

matlab.put('x', 2.)
matlab.eval('my_script')
y = matlab.get('y')

print("And the winner is:", y)

my_script.m pause(3); y = x * 2;

the result is: And the winner is: 4.0

when I change the content in my_script.m to: pause(3); y = x * 5;

I still get And the winner is: 4.0

only after I rename my_script.m to my_script.m and use matlab.eval('my_script1') can I get: And the winner is: 10.0

mrkrd commented 6 years ago

Which version of Matlab are you running?

Does the issue persist when you call my_script directly from Matlab?

Thanks for your great job! But I face some issue when I run your code. I don't know if it is a bug , every time I change the content in the m file ,I have to rename the m file. if not ,the result I run in python would be the same as what I get before I change the content in the m file.

for example:

if name == 'main':

matlab = matlab_wrapper.MatlabSession()

matlab.put('x', 2.)
matlab.eval('my_script')
y = matlab.get('y')

print("And the winner is:", y)

my_script.m pause(3); y = x * 2;

the result is: And the winner is: 4.0

when I change the content in my_script.m to: pause(3); y = x * 5;

I still get And the winner is: 4.0

only after I rename my_script.m to my_script.m and use matlab.eval('my_script1') can I get: And the winner is: 10.0

FLOWERCLOUD commented 6 years ago

Thanks for your reply! The Matlab version is R2015b win64 , and I use pycharm to run the py file. before I use matlabWrapper , I had try use mlab. such like ' from mlab.releases import latest_release as mlab ' After I reboot computer , and I add the m file path in Matlab, the issue disappear. Now matlab_wrapper works well ! Maybe there are some unkown conflicts in using mlab and matlabWrapper.