Help with Variable comparison

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Help with Variable comparison

Post by electron67 »

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

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Help with Variable comparison

Post by mnf »

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

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Help with Variable comparison

Post by electron67 »

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
Attachments
COMPARACION.fcfx
(10.08 KiB) Downloaded 214 times

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Help with Variable comparison

Post by electron67 »

I am closer

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Help with Variable comparison

Post by electron67 »

I am closer
Attachments
COMPARACION.fcfx
(8.95 KiB) Downloaded 225 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Help with Variable comparison

Post by mnf »

Try something like this:
maxima.fcfx
(8.39 KiB) Downloaded 241 times
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

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Help with Variable comparison

Post by electron67 »

Hello Martin,

Excellent !!! It works, the program is simple, I would never have done it using that method. . .

Thank You !!!
Enrique

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Help with Variable comparison

Post by mnf »

Glad to hear you got things working....

Martin

Post Reply