Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi all,
For the attached sheet, I am trying to calculate the mid-point of each layer using an if statement. The values are entered using an Excel table. For the first layer, the mid-point is simply H0/2 (so 0.9 m). For the second layer, the mid-point is the previous mid-point, plus the average of the previous and current points (so, 0.9 m + (1.8+1.6)/2 = 2.6 m). For some reason however, the simple IF code I am trying to use doesn't seem to work. I am not very familiar with programming in Mathcad, so any help would be appreciated.
Thanks!
-Fikret
Solved! Go to Solution.
I guess this is what you're after.
Recreate the little program in your Prime, and it should work.
Success!
Luc
@ftatl63 wrote:
Hi all,
For the attached sheet, I am trying to calculate the mid-point of each layer using an if statement. The values are entered using an Excel table. For the first layer, the mid-point is simply H0/2 (so 0.9 m). For the second layer, the mid-point is the previous mid-point, plus the average of the previous and current points (so, 0.9 m + (1.8+1.6)/2 = 2.6 m). For some reason however, the simple IF code I am trying to use doesn't seem to work. I am not very familiar with programming in Mathcad, so any help would be appreciated.
Thanks!
-Fikret
Why isn't the midpoint of the second layer half the thickness of the second layer plus the whole first layer?
(1.8 + 1.6/2)
Both would return the same result, but the if statement still doesn't work because it appears the statement does not store the value for z0. Thanks.
I can't see Prime 5 files. Can you attach a pdf file?
Who needs programming?
See attached version 4 file (readable in 5)
I guess this is what you're after.
Recreate the little program in your Prime, and it should work.
Success!
Luc
After I posted, I realized I am missing a for loop to step through the iterations 🙂 What you posted should work; thank you very much!
A range variable works like a for loop
A range variable works like a for loop.