How can I remove zero values from the followning label matrix?.

3 views (last 30 days)
How can I remove zero values form the following

Accepted Answer

Hikaru on 22 Sep 2014
If your matrix is A, then
A(A==0) = []
will remove the zeros. But it will change the matrix into a vector.
If you want to keep the matrix in the same shape, maybe
A(A==0) = NaN

More Answers (0)


Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!