フィルターのクリア

Matlab Script in Python to get call data

1 回表示 (過去 30 日間)
AA
AA 2021 年 7 月 18 日
コメント済み: AA 2021 年 7 月 18 日
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 件のコメント
Yongjian Feng
Yongjian Feng 2021 年 7 月 18 日
So this is more like a question about python?
AA
AA 2021 年 7 月 18 日
yeah, I want to convert this matlab script in python.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by