Using matlab engine in python, error with config_io
9 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I am currently setting up a matlab engine on python. It is working fine and I could launch some matlab scripts from python.
Yet, there are one specific matlab script that I CANNOT run from python as I get this error :
Unrecognized function or variable 'config_io'.
I do not read any error when running the script directly from matlab, nor do I when I run the script from matlab engine on python while removing that specific line.
Any advice on how to fix this ? The line config_io is really important to my script as I am working with EEG and triggers... Should I try to find a way to use config_io in python before launching the matlab engine ?
(Using matlab 2022b and python 3.11 on Windows)
Thanks in advance fro your answers,
Regards.
0 个评论
采纳的回答
Shubham
2023-4-3
Hi Soraya,
The error you are encountering is due to a missing function or variable in your MATLAB path when running the script from Python. The function or variable 'config_io' might not be accessible from the MATLAB engine when running the script from Python.
One possible solution could be to add the directory containing the necessary MATLAB function or variable to your MATLAB path before running the script from Python. You can do this by using the addpath function in MATLAB. For example, if the directory containing the necessary function or variable is located at C:\path\to\directory, you can add it to the MATLAB path as follows:
addpath('C:\path\to\directory')
You can add this line of code to your MATLAB script before the line that uses the 'config_io' function or variable.
Alternatively, you could implement the functionality of 'config_io' in Python using available libraries or by writing your own code. This might be a better solution if you need to run the script on multiple platforms or if you want to avoid dependencies on MATLAB.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!