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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Programming: while loop iteration with matrix input (MathCad Prime 8)

Hans_Westerweel
7-Bedrock

Programming: while loop iteration with matrix input (MathCad Prime 8)

Hi, could someone help me figuring out where I made a mistake in my iteration program? I would like to return a value c for every element from the input matrix, but the output shows only one value so far. I have highlighted the question in the attached sheet. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

In your program you store all results in the very same variable c, one iteration overwriting the value of the previous one. You have to collect the results in a matrix. Furthermore you were missing any initialization of c. I guessed that it should be initialized in the inner loop.

Hope this is something you looking:

Werner_E_0-1668022850697.png

 

View solution in original post

4 REPLIES 4

In your program you store all results in the very same variable c, one iteration overwriting the value of the previous one. You have to collect the results in a matrix. Furthermore you were missing any initialization of c. I guessed that it should be initialized in the inner loop.

Hope this is something you looking:

Werner_E_0-1668022850697.png

 

O yes, that looks like what I needed. Thank you very much 🙂 

Remark:

I may be wrong, but isn't this simple calculation doing the very same (just with a better precision than just 0,01 in)???

Werner_E_1-1668023439233.png

 

Yes you are right, thanks for adding that. I've been practicing more programming lately, so hadn't considered your easier solution to be honest. 

Top Tags