Using matlab engine in python, error with config_io
10 ビュー (過去 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!