14-Alexandrite
February 22, 2024
Solved
Using On Error
- February 22, 2024
- 3 replies
- 2664 views
Dear forum,
Does anyone know what the error is and why it doesn't give the result I expect?
Regards,
CarlosRomero
I don't understand why you expected a different result than the one you got!
The function does exactly what its name suggests - it deletes all COLUMNS in a matrix which consist of all zeros.
The function does not claim to deal with the rows, so rows with all-zero values remain intact.
To remove the all-zero rows as well you need a function trimZeroRows( ). But you don't have to write that function, simply use trimZeroCols on the transposed matrix and then transpose the result.

So you can also easily create a trimZeroRowsandCols( ) function in one line:

BTW, here is an alternative trimZeroCols( ) function which does not make use of my Is Element( ) function

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.