How to count negative and postive values in a matrix?

30 Ansichten (letzte 30 Tage)
trailokya
trailokya am 5 Aug. 2015
Kommentiert: trailokya am 5 Aug. 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

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 5 Aug. 2015
s=sign(A)
ipositif=sum(s(:)==1)
inegatif=sum(s(:)==-1)
  4 Kommentare
Torsten
Torsten am 5 Aug. 2015
Bearbeitet: Torsten am 5 Aug. 2015
m=mean(A(s==-1))
st=std(A(s==-1))
Best wishes
Torsten.
trailokya
trailokya am 5 Aug. 2015
Thank you sir

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by