cancel
Showing results for
Did you mean:
cancel
Showing results 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

11-Garnet

## Compute multiple values under if statement

I would like to calculate multiple values under one if statement. Right now, the only thing I know about if statement is that I have to assign if statement to a variable and that means I can only do one variable at a time. Please see below.

For this example, if I would also like to compute some other variables other than SF under condition that d<=1/4 in, without creating another if statement, what can I do?

Thank you very much!

Edit: clarify question

ACCEPTED SOLUTION

Accepted Solutions
23-Emerald II
(To:yoohooos)

@yoohooos wrote:

Thank you very much! Although, I guess this would give me multiple values for SF. I didn't mean this and sorry for not making this clear. What I meant was to compute other variables other than SF under this condition or other condition.

Ah, in that case you can just add as many lines under the one if or else statement as you like.   Use Enter or Shift-Enter at the end of your "3" expression to enter a new line (can't remember which and I've only got Mathcad Express, which doesn't have programming - hence the red rectangle).   The Help on the subject is fairly clear, IIRC.

Note that SF will contain a vector with the two values you want.

Cheers,

Stuart

4 REPLIES 4
23-Emerald II
(To:yoohooos)
Try this ...

* make your program into a function,
* create a vector of the values you want to transform and then
* apply the function to the vector using the vectorize operator.

d:=stack(0.2, 0.5, 03, 0.1, 0.7)
SF(d):= (your program .. minus the evaluation operator (=))

---->
SF(d)=

where ----> represents the vectorize operator.

Stuart

Stuart
11-Garnet
(To:StuartBruff)

Dear Stuart,

Thank you very much! Although, I guess this would give me multiple values for SF. I didn't mean this and sorry for not making this clear. What I meant was to compute other variables other than SF under this condition or other condition.

Sincerely,
Yoohooos

23-Emerald II
(To:yoohooos)

@yoohooos wrote:

Thank you very much! Although, I guess this would give me multiple values for SF. I didn't mean this and sorry for not making this clear. What I meant was to compute other variables other than SF under this condition or other condition.

Ah, in that case you can just add as many lines under the one if or else statement as you like.   Use Enter or Shift-Enter at the end of your "3" expression to enter a new line (can't remember which and I've only got Mathcad Express, which doesn't have programming - hence the red rectangle).   The Help on the subject is fairly clear, IIRC.

Note that SF will contain a vector with the two values you want.

Cheers,

Stuart

11-Garnet
(To:StuartBruff)

Then I can extract each values after that! Thank you very much!

Announcements

Top Tags