What is the meaning of following code?

1 visualización (últimos 30 días)
Prb
Prb el 18 de Jun. de 2019
Respondida: Walter Roberson el 18 de Jun. de 2019
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 18 de Jun. de 2019
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.

Más respuestas (0)

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by