Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem filtering negative values of a matrix using loop statements

Status
Not open for further replies.

erloroloco

Mechanical
Jan 16, 2007
2
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.
 
Replies continue below

Recommended for you

If you want to do it without programming, one way is:

(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
 
Already answered in Mathcad Collab. Problem was trying to modify a range variable.

TTFN



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor