cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to create a counter that counts iteratively?

dsochor
5-Regular Member

How to create a counter that counts iteratively?

In the attached MathCAD 14 worksheet, I am attempting to create a counter "v" that counts the number of times a value in an array c.a is below 1.5*hef. Is this something easy to do? I have attempted to do this with a "for" function but am not recieving the result I'm looking for.

1 ACCEPTED SOLUTION

Accepted Solutions
GuyB
2-Guest
(To:dsochor)

I wasn't sure what you wanted. Two guesses enclosed. The relevant part is copied as a picture, additional comments included in the attached Mathcad sheet.

- Guy

PS Note that the vectors (and counter) start at j=0, though your first definition of c(sub)a begins with j=1 ... even though you define ORIGIN=0.

Picture2.jpg

View solution in original post

2 REPLIES 2
GuyB
2-Guest
(To:dsochor)

I wasn't sure what you wanted. Two guesses enclosed. The relevant part is copied as a picture, additional comments included in the attached Mathcad sheet.

- Guy

PS Note that the vectors (and counter) start at j=0, though your first definition of c(sub)a begins with j=1 ... even though you define ORIGIN=0.

Picture2.jpg

You may achieve the same results as shown by Guy using for-loops more compact that way:

21.01.png

Are you aware that your vector c.a contains 5 elements? Because ORIGIN is 0 (and thats a reasonable default value anyway) and you defined beginning from c.a[1, the first element is (default) 0. If thats not on purpose I would suggest you begin your definitions with c.a[0 instead if c.a[1. Second best is setting ORIGIN to 1.

21.01.png

Top Tags