I have a matrix in MATLAB with zeroes and I would like to get another matrix with the first N non-zero elements in each row. Let\'s say for example N = 3<
N
N = 3<
N = 3; for ii=1:size(A,1); B(ii,:) = A( ii,find(A(ii,:),N) ); end