Problem filtering negative values of a matrix using loop statements
Problem filtering negative values of a matrix using loop statements
(OP)
Having a matrix defined by one column with 4000 integer values in rows, I would like to convert the negative ones into 0.
e.g.
v=[0;-1;-2;4;..]
vconvert=[0;0;0;4]
Therefore I tried to use the example described in the Mathcad13 tutorial, which skips over the nonpositive numbers with a "continue statement".I don't get a solution. Other procedures like "if statements" are also helpless for this "rookie" beginner.
I would be really delighted if someone could help me with an elegant solution.
Thanks a lot.
e.g.
v=[0;-1;-2;4;..]
vconvert=[0;0;0;4]
Therefore I tried to use the example described in the Mathcad13 tutorial, which skips over the nonpositive numbers with a "continue statement".I don't get a solution. Other procedures like "if statements" are also helpless for this "rookie" beginner.
I would be really delighted if someone could help me with an elegant solution.
Thanks a lot.





RE: Problem filtering negative values of a matrix using loop statements
http://collab.mathsoft.com/~Mathcad2000
TTFN
RE: Problem filtering negative values of a matrix using loop statements
(v + abs(v))/2
2 notes: One, make sure to vectorize the equation (matrix toolbar). Two, make sure to use the absolute value from the calculator toolbar, not the matrix toolbar (which is actually the determinate).
Peter
RE: Problem filtering negative values of a matrix using loop statements
TTFN