Hello, I thought it was an easy comparison, but comparing each variable with the others has been difficult and I got lost; I am trying to compare variables and know which is the one with the highest value; for example X1 = 25, X2 = 31, X3 = 45, X4 = 39, X5 = 40, X6 = 37, X7 = 29; how to find the correct data without so many comparisons between the variables.
Can someone help or guide me with this
Thanks
Enrique
Help with Variable comparison
Moderator: Benj
-
- Posts: 311
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 104 times
- Been thanked: 47 times
- Contact:
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: Help with Variable comparison
Hi Enrique,
Can you post your code so far?
The easiest way to do this would be to have the variables as an array (X[7]) then you can use a loop to find the highest (or lowest) value
Martin
Can you post your code so far?
The easiest way to do this would be to have the variables as an array (X[7]) then you can use a loop to find the highest (or lowest) value
Martin
-
- Posts: 311
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 104 times
- Been thanked: 47 times
- Contact:
Re: Help with Variable comparison
Hi Martin,
This flowchart is what I think could be excluding variables until reaching the highest value, but I think it would be a huge program.
Enrique
This flowchart is what I think could be excluding variables until reaching the highest value, but I think it would be a huge program.
Enrique
- Attachments
-
- COMPARACION.fcfx
- (10.08 KiB) Downloaded 223 times
-
- Posts: 311
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 104 times
- Been thanked: 47 times
- Contact:
-
- Posts: 311
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 104 times
- Been thanked: 47 times
- Contact:
Re: Help with Variable comparison
I am closer
- Attachments
-
- COMPARACION.fcfx
- (8.95 KiB) Downloaded 235 times
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: Help with Variable comparison
Try something like this:
There are alternate ways to do this - for example if measuring some data then keep a record of highest value received.
Note - toUpper$ convert a string to upper case.
Martin
Note that I have added a C line in Maxima macro that allows this to macro to work with any size data array - however it will not simulate - so I've just used a fixed count (and added a comment on what to change for real-world use)There are alternate ways to do this - for example if measuring some data then keep a record of highest value received.
Note - toUpper$ convert a string to upper case.
Martin
-
- Posts: 311
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 104 times
- Been thanked: 47 times
- Contact:
Re: Help with Variable comparison
Hello Martin,
Excellent !!! It works, the program is simple, I would never have done it using that method. . .
Thank You !!!
Enrique
Excellent !!! It works, the program is simple, I would never have done it using that method. . .
Thank You !!!
Enrique