Effacer les filtres
Effacer les filtres

Matlab Script in Python to get call data

1 vue (au cours des 30 derniers jours)
AA
AA le 18 Juil 2021
Commenté : AA le 18 Juil 2021
Dear All,
my data file is like this in .mat: data_input_file . First colum: year; Second colum: days; Third colum: data
Initially, I wrote a code in Matab to pick the data (CF) in a sliding window fashion (-5, +5) days and then stacks the values in other variable . MAtlab script is
bpn=1
for i = 1:lengday % for i in range(lengday)
zz2 = 0;
zz=0;
for j = -5:5 % days to be stacked
k=i+j;
if k > lengday; k = lengday; end
if k <1; k = 1; end
zz =CFdata(k).NCF(1:end,bpn)'./max(CFdata(k).NCF(1:end,bpn))/(abs(j)+1);
zz2= zz2+zz;
end
I required to transform my script to python. However, the last line of script is not working: Here is my attempted, these variables are defined in below, if i dont use the [K] , it will work but with [k], it gives the error.
zz =mat['CFdata'][k]['NCF'][0:lastday,1]/max([mat['CFdata']['NCF'][0:lastday,1]])/[abs(j)+1]
Function of the above line: This line select a specific day, then take the data of plus/mins 5 days (around the selected day). Afterward, stack the data of all 11 days.
Parameteres used in the above line is defined defined as below:
parameteres used here difinied as
CFdata=mat.get('CFdata')
time=mat.get('CFtime')
day=CFdata["day"]
year=CFdata["year"]
NCF=CFdata["NCF"]
firstday=1
lengday=len(day[0])
  2 commentaires
Yongjian Feng
Yongjian Feng le 18 Juil 2021
So this is more like a question about python?
AA
AA le 18 Juil 2021
yeah, I want to convert this matlab script in python.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Call Python from MATLAB 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