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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Compute multiple values under if statement

yoohooos
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.

Annotation 2020-05-16 093400.png

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

1 ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
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.

 

2020 05 16 C.png

 

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

 

Cheers,

 

Stuart

 

 

View solution in original post

4 REPLIES 4
StuartBruff
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

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

StuartBruff
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.

 

2020 05 16 C.png

 

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

 

Cheers,

 

Stuart

 

 

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

Top Tags