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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to create a counter that counts iteratively?

dsochor
10-Marble

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.

ACCEPTED SOLUTION

Accepted Solutions
GuyB
10-Marble
(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
10-Marble
(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

Werner_E
25-Diamond I
(To:dsochor)

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

Announcements

Top Tags