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

Home » Public Forums » archive » Re: 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 #80301 is a reply to message #80298] Thu, 31 May 2012 05:07 Go to previous messageGo to previous message
Tito is currently offline  Tito
Messages: 16
Registered: March 2012
Junior Member
OK I tried and I fail.... I did this:

zz = []
f=indgen(n_elements(amp)) ;; (f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])

for i=0L, n_elements(amp)-1 do begin
a = where(amp[i] eq amp ,count)
if count gt 0.0 then begin
if n_elements(a) gt 1 then begin
zz = [zz,i] ;; (zz =[3,4,6,7,8,9,10])
endif
endif
endfor

if n_elements(zz) ne 0.0 then begin
match2,f,zz,subf,subzz
f[subzz] = -1
f = f[where(f[*] NE -1)] ;; (f = [0,1,2,5,11,12,13,14,15]) So far great!

;;amp[zz] = [0.5538, 0.5538, 0.5524, 0.5524, 0.5524, 0.1255, 0.1255]

ss = unique(amp[zz],count) ;; (ss=[0.5538, 0.5524, 0.1255])
dd = dblarr(n_elements(ss),20)*0-1
for i = 0L , n_elements(ss)-1 do begin
a = where(ss[i] eq amp,count)
dd[i,a] = a
endfor
endif

;; 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


And the question... how can I remove the '-1' and to get 3 diferent vector [3,4] [6,7,8] and [9,10] ???

thank you !
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: VM Save File Problem
Next Topic: Re: help with mathematics

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

Current Time: Fri Oct 10 18:46:48 PDT 2025

Total time taken to generate the page: 0.64166 seconds