How to count?
显示 更早的评论
Hello all, I have a stochastic signal, and I want to count how many of the samples are positive,and how many are negative. Any suggestions?
采纳的回答
更多回答(1 个)
Titus Edelhofer
2011-4-5
Hi Negar,
just count them
nPos = sum(x1==1)
nNeg = sum(x1==-1)
Titus
1 个评论
Jan
2011-4-5
SUM is usually faster than LENGTH(FIND).
nNeg = numel(x1) - nPos
类别
在 帮助中心 和 File Exchange 中查找有关 Signal Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!