필터 지우기
필터 지우기

What is the meaning of following code?

조회 수: 2 (최근 30일)
Prb
Prb 2019년 6월 18일
답변: Walter Roberson 2019년 6월 18일
Hi I would lioke to know the meaning of the following code
NewRes(:,:,Channel,:) = Residuals([1:2:size(Residuals,1)],[1:2:size(Residuals,1)],Channel,:);
what is the syntax here is suggesting. I would like to repesent this in Python.
Thanks

채택된 답변

Walter Roberson
Walter Roberson 2019년 6월 18일
size(Residuals,1) is the number of rows in the Residuals array. 1:2:size(Residuals,1) is the odd-numbered rows. [1:2:size(Residuals,1)] in context is redundant and could be just 1:2:size(Residuals,1) .
So the odd-number rows are selected from Residuals, and the same numbering is used for the columns as well . That is a little risky unless Residuals is known to be the same number of rows and columns.
Channel is kept constant, a scalar, and used to index the third dimension.
All of the 4th dimension is selected.
So Newres in the third pane selected by Channel becomes the odd-numbered rows and columns of Residuals from the third pane selected by Channel.

추가 답변 (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