get a matrix of only zero

1 vue (au cours des 30 derniers jours)
Salvatore Mazzarino
Salvatore Mazzarino le 10 Nov 2012
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

Réponses (4)

Matt Fig
Matt Fig le 10 Nov 2012
A = zeros(2,5)

Walter Roberson
Walter Roberson le 10 Nov 2012
Modifié(e) : Walter Roberson le 10 Nov 2012
NewMatrix = 0 .* OldMatrix;
(Mind you, this has a problem if any of the entries were infinite or NaN)

Matt J
Matt J le 10 Nov 2012
newmatrix=zeros(size(oldmatrix));

Matt J
Matt J le 10 Nov 2012
yourmatrix(:)=0;

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by