12-29-2009 08:00 AM
My example and all of yours only work because 70 is the last value, but if you put it before the biggest value, it doesn't return 48 as the max value. It returns the last value until it reaches the value 70 in the array...
It stops seaching when it reaches a value bigger than 50 😞
Muks, you example returns 50 as the biggest number... I need 48... I don't want to coerce the values...
12-29-2009 08:05 AM
12-29-2009 08:54 AM
This is what you have, right?
But notice that is I put 75 as the 4th value in the array, your code returns 35 as the higher value... it should return 45... 😞
12-29-2009 08:57 AM - edited 12-29-2009 08:59 AM
alpol wrote:Thanks
[...]
Maybe yous is better,jcarmody but I need the array intact to know the element position in the array
Any idea how I should know what index the value has in the array to identify the position of the value?
Now I need to know what
Your question ignores the possibility of two elements sharing the distinction of being the highest value. This solution gives the index of the first element with the highest value. This is not very far from the original post I made.
Edit - mine works regardless of the order of the array. Putting a high number early in the array won't affect the functionality.
12-29-2009 10:24 AM
Quite Simple but a fun exercize THANKS!
12-29-2009 10:42 AM
Thanks, both of the last two posts solve the problem of finding the max value lower than 50, but now I was going to add this to my program and I realyzed that what I need is the first index of a 2d array I have...
let's see... I have for example
20 23 24 26
36 48 34 20
21 35 70 39
If this was my array, columns are values x1, x2, x3 and x4 and I need the number of the row, to retrieve the corresponding timestamp from a file...
again... any ideas?
12-29-2009 03:17 PM
hi
without sorting, a vi i made - as i suggested in one post- is fairly easy, I attached here. it takes less than a second for an array of doubles of 32000 values.
for 2d you can build on this (or other examples), put another for loop.
n
12-29-2009 06:42 PM
Thank you all!
Problem solved
Happy new year to all of you!