-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatlabUtils.py
More file actions
33 lines (23 loc) · 748 Bytes
/
Copy pathMatlabUtils.py
File metadata and controls
33 lines (23 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import matlab.engine
engine = None
def find_engine():
global engine
if engine is not None:
return engine
engines = matlab.engine.find_matlab()
print(engines)
if engines:
print("Found MATLAB engine! connecting ...")
engine = matlab.engine.connect_matlab(engines[0])
print("Found MATLAB engine! connected")
else:
print("No MATLAB engine found, launching new one ...")
engine = matlab.engine.start_matlab()
print("No MATLAB engine found, launched new one")
engine.addpath('amsbss/ILRMA')
engine.addpath('amsbss/AuxIVA')
engine.addpath('amsbss/AuxIVA/STFT')
return engine
def stop_engine(engine):
if engine is not None:
engine.quit()