1 Pages (16 items)
Assign certain values to a variable - Messages
#1 Posted: 9/1/2021 10:44:15 AM
Hallo guys i have a problem and i dont know how to write it in smath.
for example:
i have a variable and i want to assign certain values depending on other values.
for example:
Variables:
a=1
b=2
e=1 or 2 for example
and now:
c:= a if e=1
b if e=2
and then
OK if c=1
NOK if c=2
also i can remember the function sverweis in mathcad to assign certain values to a variable out of a matrix
i dont know how to write in smath
i know its easy example but its only for demonstration
I know how to write in mathcad but not in smath
thank you br Stefan
for example:
i have a variable and i want to assign certain values depending on other values.
for example:
Variables:
a=1
b=2
e=1 or 2 for example
and now:
c:= a if e=1
b if e=2
and then
OK if c=1
NOK if c=2
also i can remember the function sverweis in mathcad to assign certain values to a variable out of a matrix
i dont know how to write in smath
i know its easy example but its only for demonstration
I know how to write in mathcad but not in smath
thank you br Stefan
#2 Posted: 9/1/2021 11:28:36 AM
Attach your Smath work sheet !
#3 Posted: 9/1/2021 11:41:06 AM
Test.sm (5 KiB) downloaded 35 time(s).
just trying. I think i got it but is there a better way to assign such values?
I just want to do it with if only
So that
e:= if a=1 then e=10
if a=2 then e=11
if a=3 then e=12
if a=4 then e=13
if a=5 then e=14
if a=6 then e=15
like this way
and so on not with if else if else is a little bit confusing
thank you best regards stefan
just trying. I think i got it but is there a better way to assign such values?
I just want to do it with if only
So that
e:= if a=1 then e=10
if a=2 then e=11
if a=3 then e=12
if a=4 then e=13
if a=5 then e=14
if a=6 then e=15
like this way
and so on not with if else if else is a little bit confusing
thank you best regards stefan
#4 Posted: 9/1/2021 11:56:16 AM
i think i have a similar problem like this on here:
https://en.smath.com/forum/yaf_postst723_if-without-else.aspx
if without else
is there somehow a workaround?
https://en.smath.com/forum/yaf_postst723_if-without-else.aspx
if without else
is there somehow a workaround?
#5 Posted: 9/1/2021 1:04:53 PM
One of the options


1 users liked this post
Stefan Müller 9/1/2021 3:09:00 PM
#6 Posted: 9/1/2021 1:25:26 PM
thank you but im having troubles writing this code.
How you write the if without else and how do you write the otherwise
i see no otherwise and i always have the if with else statement
or do i need a plugin for your function?
thank you
How you write the if without else and how do you write the otherwise
i see no otherwise and i always have the if with else statement
or do i need a plugin for your function?
thank you
#8 Posted: 9/1/2021 2:02:57 PM
#9 Posted: 9/1/2021 2:21:59 PM
Decision Variable.sm (7 KiB) downloaded 32 time(s).
i now encounter another problem. If i have many decisions how can i align the variables vertically?
I have not enough place on the sheet so that every variable can stay there in one row
like in the sheet
i now encounter another problem. If i have many decisions how can i align the variables vertically?
I have not enough place on the sheet so that every variable can stay there in one row
like in the sheet
#11 Posted: 9/1/2021 4:39:03 PM
Are you trying to achieve this?
It takes very little space on sheet.
You did mentioned vlookup function.
This gives a variable depending on a decision.
Or maybe I have lost in the context.
Regards
decision_r1.sm (4 KiB) downloaded 36 time(s).

It takes very little space on sheet.
You did mentioned vlookup function.
This gives a variable depending on a decision.
Or maybe I have lost in the context.
Regards
decision_r1.sm (4 KiB) downloaded 36 time(s).
1 users liked this post
Stefan Müller 9/7/2021 7:21:00 AM
#12 Posted: 9/2/2021 3:17:31 AM
@ Jean i dont find this f(x) menü cases. Do i need a plugin for this feature?
can you describe me how i do get to this if otherwise statement?
Thank you for the support so far. Im really beginner to smath
can you describe me how i do get to this if otherwise statement?
Thank you for the support so far. Im really beginner to smath
#13 Posted: 9/2/2021 3:26:01 AM
Wrote@ Jean i dont find this f(x) menü cases. Do i need a plugin for this feature?
can you describe me how i do get to this if otherwise statement?
Thank you for the support so far. Im really beginner to smath
It is the function cases from custom functions plugin. To add more "if cases" you have to type twice your argument separator key.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Stefan Müller 9/7/2021 7:21:00 AM
#15 Posted: 9/2/2021 8:30:15 AM
WroteDo i need a plugin for this feature?
Can you describe me how i do get to this if otherwise statement?
Thank you for the support so far. I'm really beginner to smath
You need to install Custom Functions plugin.
After you have installed Custom Functions plugin;
You can either enter it from menu, Insert > Function > Cases().
Or you can press Ctrl+E key combination and insert Cases().
Or simply type cases(), press Tab or click on it and will be added.
Last one is how most people insert it I guess.
Please don't hesitate to ask anything.
You will find out this is one of the most friendly forums on internet.
Everyone is eager to help and shall try to reply your questions.
Regards
1 users liked this post
Stefan Müller 9/7/2021 7:22:00 AM
#16 Posted: 9/2/2021 8:43:08 AM
Ok thank you i think i got it i can expand it with a "shift" + "," pushing then if cases will be added
1 Pages (16 items)
-
New Posts
-
No New Posts