comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to spot maximum x value AND corresponding y value?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to spot maximum x value AND corresponding y value? [message #69824] Thu, 18 February 2010 05:29
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
M. writes:

> So I know, with your suggestion, that my
> x_max_val let's say is located in the 7th row in the 1st col. BUT, how
> can I find out which y value (2nd col) is in the 7th row.

You know what you need? More coffee. Your brain
is not activated yet this morning! I would guess
the y value you are looking for is also in the 7th
row. If fact, the z value that goes with that x value
is *also* in the 7th row! :-)

x = array[0,7]
y = array[1,7]
z = array[2,7]

But, even when you get this sorted out, your troubles
are only beginning. I think you are going to have to
re-think (get a LOT of coffee!!) your original premise
on how to attached these points together. It's a lot
harder to do this correctly than you imagine. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: How to spot maximum x value AND corresponding y value? [message #69826 is a reply to message #69824] Thu, 18 February 2010 04:19 Go to previous message
M. is currently offline  M.
Messages: 2
Registered: February 2010
Junior Member
On Feb 16, 4:26 pm, pp <pp.pente...@gmail.com> wrote:
> On Feb 16, 10:23 am, "M." <markus_men...@yahoo.de> wrote:
>
>> I have an input file (ascii) containing coordinate data (three
>> columns; x, y, z).
>> I want to compute a vector from one point to another. I know the
>> vector should go from the maximum x value to the minimum y value (or
>> vice versa). I took the FLOAT function to find out the min and max
>> values. But how can I find out the corresponding x and y values for my
>> y_min and x_max values?
>
> Your question is not very clear, but I am guessing that what you want
> is to find out which points have the maximum/minimum x and y values.
> Which would be something like:
>
> x_max_val=max(x,x_max_ind,min=x_min_val,subscript_min=x_min_ ind)
> y_max_val=max(y,y_max_ind,min=y_min_val,subscript_min=y_min_ ind)
>
> Which would give you the maximum value of x in x_max_val and the index
> where that occurs in x_max_ind. That is,
> x_max_val==x[x_max_ind]==max(x).


Uh, that's true. The question was really not clear. I'm not yet firm
with scientific terms and IDL language...
But you guessed right and helped me a lot. What I need are two points
in a coordinate system, one point has the the maximum x value and one
point has the minimum y value. With your suggestion I now know where
the min or max values are located in my array. Good.
But:
My data (ascii) is build like a table (3 columns - 1st col = x
coordinates; 2nd col = y coordinates; 3rd col = z values and about 1.5
Million rows each column). So I know, with your suggestion, that my
x_max_val let's say is located in the 7th row in the 1st col. BUT, how
can I find out which y value (2nd col) is in the 7th row. Since these
are coordinates I need both the maximun x value and where it occurs on
the y axis - that is what I mean with corresponding value. Is there an
order like: "result = (y) value in the 2nd col which is located where
x_max_val occurs" OR "result = value in the 2nd col which is located
at 'x_max_ind'" -->see above .
I tried to find it out by myself, but I just don't know the right
command I think.
Can anybody understand what I mean and help me? Thanks.
Markus

P.S. here is how my array looks:

array = FLTARR(3, n)
array[0,*] = 1st col with x values from ascii text file
array[1,*] = 2nd col with y values from ascii text file
array[2,*] = 3rd col with z values from ascii text file
Re: How to spot maximum x value AND corresponding y value? [message #69848 is a reply to message #69826] Tue, 16 February 2010 07:26 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Feb 16, 10:23 am, "M." <markus_men...@yahoo.de> wrote:
> I have an input file (ascii) containing coordinate data (three
> columns; x, y, z).
> I want to compute a vector from one point to another. I know the
> vector should go from the maximum x value to the minimum y value (or
> vice versa). I took the FLOAT function to find out the min and max
> values. But how can I find out the corresponding x and y values for my
> y_min and x_max values?

Your question is not very clear, but I am guessing that what you want
is to find out which points have the maximum/minimum x and y values.
Which would be something like:

x_max_val=max(x,x_max_ind,min=x_min_val,subscript_min=x_min_ ind)
y_max_val=max(y,y_max_ind,min=y_min_val,subscript_min=y_min_ ind)

Which would give you the maximum value of x in x_max_val and the index
where that occurs in x_max_ind. That is,
x_max_val==x[x_max_ind]==max(x).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Open URL in external browser
Next Topic: Re: Coyote Cojones

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:31:51 PDT 2025

Total time taken to generate the page: 0.00539 seconds