How to pass the variables from matlab workspace to python function, and run this python function in matlab
95 views (last 30 days)
Zhida DENG on 1 Apr 2016
I am trying to pass the variables from matlab workspace to python function which scripting as:
and then I calling this python function in matlab command window by typing ' py.f.f' , however, the error occurred: Python Error: NameError: global name 'x' is not defined .
It would be much appreciated that if someone could help me to solve this, pass the variable from matlab to python function, and call the python function in matlab.
More Answers (3)
Amir tb on 19 Jun 2020
Dear firends, I'm new in Matlab coding. This is a code my teacher sent to me. It's about reading 5 .wav sounds with different lengths. The purpose is dividing each sound samples by 2000 sample for each and then figure it and process each figure seperately. For example for a sound with a length of 70000, it devides the sound into 35, 2000 samples which give us 35 seperate figures for each 200 sample.
My question is would you please explain me the code line by line?
And other question is how can I change the code such that having saved figure of each sample seperately in a new directory?
files = dir(fullfile('C:\Users\Amir\Desktop\Articles\PCG classification\matlab code\mamadreza\*.wav'));
plot(normalize, 'w', 'LineWidth', 2)