How to delete zeros from matrix delete and delete! does not work?
2 Likes
Letās say you have:
[1 0 1;
0 1 1;
0 0 1]
What do you want the result of ādelete zerosā to be?
4 Likes
Just in case youāre talking about sparse matrices, then the functions youāre looking for are dropzeros()
and dropzeros!()
.
2 Likes
in what packgate is because it doesn;t work?
ŠæŠ¾Š½, 28. Š¾ŠŗŃ 2019. Ń 17:13 Jamie via JuliaLang julialang@discoursemail.com ŃŠµ Š½Š°ŠæŠøŃŠ°Š¾/Š»Š°:
If dropzeros
doesnāt work then it wonāt be applicable to your case ā it only applies to SparseArrays.
Probably what you want is something like filter(!iszero, A)
, which will return all nonzero elements as a vectorā¦ but you could also reasonably want all rows without any nonzeros, or all rows that arenāt all nonzero, or ā¦, or ā¦
We need a bit more to go on
2 Likes