How to find the indices of nonzero rows in a matrix?
Example:
A = [ 14 0 6 9 8 17 85 14 1 3 0 99 0 0 0 0 0 0
Use
[i,~] = ind2sub(size(A),find(A)); v = unique(i);
Result for the matrix given above:
v = unique(i') v = 1 2 4 6