Assuming the vector is named v, you can count the number of positive values in v using the following code snippet in MATLAB:
main.m26 chars2 lines
nnz stands for "number of non-zeros" and counts the number of elements in the logical array v > 0 that are true. This gives us the number of positive values in the vector.
Alternatively, you can also use the MATLAB sum function to achieve the same result:
main.m26 chars2 lines
Both of these methods should give you the number of positive values in the vector v.
gistlibby LogSnag