Getting error while importing numpy in MATLAB
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Sajid Sarwar
am 22 Okt. 2020
Kommentiert: Ameer Hamza
am 25 Okt. 2020
I have installed a MATLAB supported version python 3.5. I have also installed numpy library and it can be imported in python compiler. But when I try a numpy code in MATLAB it gives error like this
x=py.numpy.linspace(0,10,101);
it gives following error which I am unable to understand.
Error using function_base>linspace (line 121)
Python Error: TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
Error in <__array_function__ internals>>linspace (line 6)
I need help to resolve this issue as I need to use python comands in MATLAB.
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 22 Okt. 2020
This issue happens in the latest versions of numpy. Following will work
x = py.numpy.linspace(0, 10, py.numpy.int(101))
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!