Drop down options

Drop down options - Select variable based on the value of another variable - Messages

#1 Posted: 4/30/2020 5:32:46 AM
Praveen P K

Praveen P K

0 likes in 2 posts.

Group: User

Hi I am new to Smath

I want to select few variables. eg
If P=1, then X = 1, Y=2 & Z=3
If P=2, then X = 4, Y=1 & Z=7
If P=3, then X = 3, Y=2 & Z=1

I want to use X, Y & Z values based on the selected value of P

Thanks in advance
#2 Posted: 4/30/2020 8:33:57 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

p[XYZ].PNG
#3 Posted: 4/30/2020 8:36:30 AM
Praveen P K

Praveen P K

0 likes in 2 posts.

Group: User

Thanks Jean

I will try this one
#4 Posted: 4/30/2020 8:42:33 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Using "cases" function.
Cases_Function.png

cases_ex.sm (89 KiB) downloaded 29 time(s).
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
1 users liked this post
Davide Carpi 5/1/2020 8:59:00 AM
#5 Posted: 4/30/2020 9:26:22 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I will try this one



Page1 if_oterwise.sm (4 KiB) downloaded 33 time(s).
1 users liked this post
Davide Carpi 5/1/2020 9:00:00 AM
#6 Posted: 4/30/2020 11:25:14 AM
haweHofmann

haweHofmann

3 likes in 32 posts.

Group: User

If you want to use the variable names X,Y,Z

a simple

data:mat(1,4,3,2,1,2,3,7,1,3,3)
mat(X,Y,Z,3,1):col(data,p)

will do the job.

you can also use a vector XYZ
XYZ:el(data,range(1,3),p)
and its components i=1..3
el(XYZ,i)

--
copy code to sheet
1 users liked this post
Davide Carpi 5/1/2020 8:59:00 AM
#7 Posted: 4/30/2020 12:41:19 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Generalize demo. No sweat to capture [X,Y,Z] from n*m matrix.

Page5 Generalize.sm (5 KiB) downloaded 37 time(s).
  • New Posts New Posts
  • No New Posts No New Posts