Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Conversion to int64 from py.numpy.ndarray is not possible." when using py2mat.m as illustrated in your pdf #2

Closed
gpinardi opened this issue May 11, 2023 · 2 comments

Comments

@gpinardi
Copy link

Hello,

many thanks for this tool, which looks great. I am follwing step by step the illustrations you give in your pdf "python-for-matlab-development.pdf" (downloaded from here: https://www.matlabexpo.com/content/dam/mathworks/mathworks-dot-com/images/events/matlabexpo/online/2022/python-for-matlab-development.pdf)

I managed to reproduce everything up to slide 14, but I have a problem with:

double(z.get('x'))
Error using double
Conversion to double from py.numpy.ndarray is not possible.

I also have problems with py2mat (downloaded from here just now):

m = py2mat(z)
Error using int64
Conversion to int64 from py.numpy.ndarray is not possible.

Error in py2mat (line 98)
x_mat = int64(x_py.astype(np.float64));

Error in py2mat (line 67)
new_var = py2mat(x_mat.(fields{i}));

I am using the following versions, under linux:
Matlab version:

version
ans =
'9.9.0.1570001 (R2020b) Update 4'

python access, through:

pyenv
ans =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/bira-iasb/softs/21g/py39/bin/python"
Library: "libpython3.9.so.1.0"
Home: "/bira-iasb/softs/21g/py39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "1515974"
ProcessName: "MATLAB"

Any clue?
Thanks!
Gaia

@gpinardi
Copy link
Author

actually, by searching with some of the error messages that I got, I have found that this is related to some problems between matlab2020b and python3.9 (fooof-tools/fooof_mat#22)

I solved my problem by downgrading to Python 3.6.

@AlDanial
Copy link
Collaborator

Thanks for the follow-up post. You're on the right track; according to the compatibility table, 2020b only supports up to Python 3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants