I am trying to convert these 2 lines of Matlab code into python. first line is fine but how could I change the 2nd line?

Question:

This is my MATLAB code. Note that T_cqi=28

gamma_real=reshape(gamma_dB(:,(length(CQI_init)+1):end),[1,length(CQI_test)*T_cqi]); 
gamma_real=gamma_real(1:(end-(T_cqi-1)));

This part in matlab is (length(CQI_init)+1=180 in python it works with 179

I convert it like this:

gamma_real=np.reshape(gamma_dB[:,179:],[1,(CQI_test.size)*T_cqi])

which is fine but I am not able to do the second line? how could i do this? what should I write for end key word?

Asked By: Mario

||

Answers:

In python, no index for the second indexer automatically refers to the end of the array, so try:

gamma_real=gamma_real[: -T_cqi]

(No index for the first index refers to the first index which is 0 in Python)

Answered By: PlainRavioli
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.