Calling user matlab functions from Python
Mostrar comentarios más antiguos
I have 4 user created matlab functions "aaa.m, bbb.m, ccc.m and ddd.m" which are stored in a dictionary(dict) as values against keys.
eng = matlab.engine.start_matlab()
eng.addpath(Path)
for key in dict.keys()
matlabFileName = dict[key]
eng.matlabFileName(nargout=0)
eng.quit()
The above code gives the error "matlab.engine.MatlabExecutionError: Undefined function or variable 'matlabFileName'
How do i call a function from matlab engine when the function name is a VARIABLE.
Please help.
6 comentarios
Mohammad Sami
el 30 de Mzo. de 2020
You can try the eval function instead.
JSO CI Team Veoneer
el 30 de Mzo. de 2020
Mohammad Sami
el 30 de Mzo. de 2020
Editada: Mohammad Sami
el 30 de Mzo. de 2020
Yes you can use the eval like
eng.eval(matlabFileName , nargout = 0)
Another option is described at the following link
JSO CI Team Veoneer
el 30 de Mzo. de 2020
JSO CI Team Veoneer
el 30 de Mzo. de 2020
Respuestas (0)
Categorías
Más información sobre Call Python from MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!