What is the meaning of following code?

1 次查看(过去 30 天)
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