How to count negative and postive values in a matrix?

22 次查看(过去 30 天)
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

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2015-8-5
s=sign(A)
ipositif=sum(s(:)==1)
inegatif=sum(s(:)==-1)
  4 个评论
Torsten
Torsten 2015-8-5
编辑:Torsten 2015-8-5
m=mean(A(s==-1))
st=std(A(s==-1))
Best wishes
Torsten.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by