matlab - get number of element greater than 0 in column -
in matrix, want number of element in column has value greater 0. example have matrix that;
1 2 4 5 0 0 1 2 1 1 1 1 xi = number of element greater 0 in column i. then, x1=2, x2=2, x3=3, x4=3
but must without loop. (id use loop, computation time gets high)
if matrix a
, do:
x = sum(a>0,1);
each element of x
contain number of elements greater 0 in column.
best
Comments
Post a Comment