Hi Guys
Can anyone help with the issue below. i am trying to find minimum value (other than zero) in a matrix.
for example (see screenshot below), i would like to extract non-zero value from a matrix and then find the lowest value in the new matrix. appreciate if you could provide some guidance. thanks
This function deletes all the rows of a matrix (or vector) that contain only zeros.
Hi Richard, thanks for the prompt response.
the solution works. many thanks
Jo
Here is a different approach. Its a One-Liner using functions from the Data Analysis Pack, which ist part of most Mathcad installations, I guess.
In contrary to Richards routine, when fed with a matrix it will trim all lines containing just a single zero, not only the all zero rows.
When fed with an all zero vector, it return this vector unchanged (while Richards routine throws an error, which is better, I guess).
An annoying drawback due to a limitation/bug in the built-in match command is, that any value lower or equal than TOL is considered to be zero.
You can cope with that only by changing the value of TOL BEFORE the definition of filterZero or by writing your own match-routine.
Werner
Hi Werner
Is there any equivalent function in mathcad prime to remove zeros?
Thanks
Tomek
The routine given here will work the very same in Prime, too.
Only difference is that instead of the "yyy on error xxx" in Mathcad you would use the equivalent "try xxx on error yyy".
For a more refined program and and alternative to using "match" see here: