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

Home » Public Forums » archive » help with sorting vector elements in to subarrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: help with sorting vector elements in to subarrays [message #80448 is a reply to message #80234] Thu, 31 May 2012 06:53 Go to previous message
Tito is currently offline  Tito
Messages: 16
Registered: March 2012
Junior Member
On Thursday, May 31, 2012 2:36:29 PM UTC+2, (unknown) wrote:
> Would this do it?
>
> for i = 0L, n_elements(ss)-1 do print,where(ss[i] eq amp)
>
> greg

Thanks for the fast answer Greg!

I all ready did something similar with:

for i = 0L , n_elements(ss)-1 do begin
a = where(ss[i] eq amp,count)
dd[i,a] = a
endfor

I just wanted to record this indexies in seperate arrays and use it later on.
But you are right... why not use it inside the loop???

For example:

for i = 0L, n_elements(ss)-1 do begin
a = where(ss[i] eq amp,count)
for ii = 0L, n_elements(a)-1 do spec = spec - (amp[a[ii]]*exp((-1d0*(wave-line[a[ii]])^2d0)/var[a[ii]]))/n _elements(a)
endfor

I think I will be fine from now on....

Any way is there a way how to extract the neeeded data from ;; Now dd = Double[3, 20]
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
3.0000000 -1.0000000 -1.0000000
4.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 6.0000000 -1.0000000
-1.0000000 7.0000000 -1.0000000
-1.0000000 8.0000000 -1.0000000
-1.0000000 -1.0000000 9.0000000
-1.0000000 -1.0000000 10.000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
-1.0000000 -1.0000000 -1.0000000
??? Just want to know.....
All the best!
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: help with mathematics
Next Topic: put a variable in 2D-array to plot a contour on a map.

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

Current Time: Wed Oct 08 19:36:26 PDT 2025

Total time taken to generate the page: 0.34579 seconds