get a matrix of only zero

How can I get a mattrix made of only zeros?
For example I have this matrix
[2 4 0 5 6 0]
I would get a matrix made of only zeros

Respuestas (4)

Walter Roberson
Walter Roberson el 10 de Nov. de 2012
Editada: Walter Roberson el 10 de Nov. de 2012

0 votos

NewMatrix = 0 .* OldMatrix;
(Mind you, this has a problem if any of the entries were infinite or NaN)
Matt J
Matt J el 10 de Nov. de 2012

0 votos

newmatrix=zeros(size(oldmatrix));

Categorías

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

Preguntada:

el 10 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by