Closed alexjwilliams closed 7 years ago
I have honestly never tried this. It seems kind of convoluted to use Python to tell Matlab to load Java code. That said, import
is just a regular function, so import('edu.stanford.math.plex4.*')
should work.
That doesn't work because import
is a reserved keyword in Python. I figured out a way around this (by putting the import statement in the matlab code, and writing more logic in matlab than in Python), so I don't need any more help, but others in the future might want to be able to call Matlab import from Python. Just letting you know.
Thank you for bringing this up.
You can always use Python's getattr
if the keyword is taken:
import transplant
m = transplant.Matlab()
importfunc = getattr(m, 'import')
And then use importfunc
instead of import
.
Hello,
I am working on a school project where I need to use java classes in MATLAB. In a regular matlab script you can import java classes using the following syntax:
import edu.stanford.math.plex4.*;
. How can I execute these types of statements using transplant?Thanks, Alex WIlliams