How to count negative and postive values in a matrix?

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

 Risposta accettata

s=sign(A)
ipositif=sum(s(:)==1)
inegatif=sum(s(:)==-1)

4 Commenti

But how can i get the mean and standard deviation of the negative values sir?
Use mean and std functions
Torsten
Torsten il 5 Ago 2015
Modificato: Torsten il 5 Ago 2015
m=mean(A(s==-1))
st=std(A(s==-1))
Best wishes
Torsten.

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by