what this colon mean in this code

buf(:,:) = abs(p(:,1,:)); norm_buf=buf./max(max(buf));
i have this code as a part of program but i did not get what is mean

 Respuesta aceptada

Star Strider
Star Strider el 27 de Abr. de 2017

0 votos

The colons here mean all the elements in that particular ‘page’ of the matrix. See the documentation for colon,: (link) for the details.

2 comentarios

waad Alzahrani
waad Alzahrani el 27 de Abr. de 2017
i saw this! but still did not get it, can u explain it to me in this particular code please
Star Strider
Star Strider el 27 de Abr. de 2017
I will do my best.
For example if ‘p’ is a (2x3x4) matrix, ‘p(:,1,:)’ is the same as: ‘p(1:2,1,1:4)’.
Writing ‘p(:,1,:)’ is easier, especially if the size of ‘p’ changes either within a particular script, or between different runs of the script or calls to a function.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 27 de Abr. de 2017

Comentada:

el 27 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by