Compute multiple values under if statement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Solved! Go to Solution.
- Labels:
-
Civil_Engineering
-
Programming
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
* 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Then I can extract each values after that! Thank you very much!
