How to count negative and postive values in a matrix?

53 vues (au cours des 30 derniers jours)
trailokya
trailokya le 5 Août 2015
Commenté : trailokya le 5 Août 2015
Sir, how can i get the mean and standard deviation and total numbers of negative values and similarly for positive values in a matrix A(i,j).Please help

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 5 Août 2015
s=sign(A)
ipositif=sum(s(:)==1)
inegatif=sum(s(:)==-1)
  4 commentaires
Torsten
Torsten le 5 Août 2015
Modifié(e) : Torsten le 5 Août 2015
m=mean(A(s==-1))
st=std(A(s==-1))
Best wishes
Torsten.
trailokya
trailokya le 5 Août 2015
Thank you sir

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices 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