how to pass folder path to custom function using MATLAB engine API for python

3 vues (au cours des 30 derniers jours)
ARP
ARP le 18 Sep 2022
Modifié(e) : ARP le 18 Sep 2022
I have a funciton to load and process data in matlab, and I would like ot use it in python.
Using the matlab engine, I can call simple functions (standard and custom) that have input as double.
The problem is that when having the input a string(path folder), the funciton returns (0,0) and should be an array of many columns.
The Python code is below
Thanks in advance
import matlab.engine
import matlab
import numpy as np
eng = matlab.engine.start_matlab()
folder="D:\matlab results...." # The folder path with text files to process
Amplitudes_all=eng.import_matlab_data(folder) # function reads text files in selected folder and makes a 2D array with every file columnwise
ampsasarray=np.asarray(Amplitudes_all)
eng.quit()

Réponses (0)

Catégories

En savoir plus sur Call MATLAB from Python dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by