Hello
How to select first n nonzero elements from each row?
If I have matrix A, and I want result like B (three nonzero elements from each row):
Rusult also can be cell..
A=[1 3 0 2 5 0 2 0 1 0 2 0 0 0 0 3 1 1 0 0];B=[1 3 2 2 1 0 2 0 0 3 1 1];
Best Answer