필터 지우기
필터 지우기

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 CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by