Re: help with sorting vector elements in to subarrays [message #80448 is a reply to message #80234] |
Thu, 31 May 2012 06:53  |
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!
|
|
|