0

残念ながら、私はこの問題に対する答えを見つけることができず、質問をしなければなりませんでした。他の場所に答えがある場合は、お詫び申し上げます。私は IDL を初めて使用し、これを完全に表現する方法を知りませんでした。

私のコードは以下の通りです:

for i=0,delta-1 do begin
    print, flrarray[i]
    numbr_for_arr=where(del gt ((flrarray[i])-0.000001) and del lt ((flrarray[i])+0.000001))
    print,numbr_for_arr
    postnflrarray[i]=numbr_for_arr
endfor

デルタは単なる数値です。finalflrarray は、del (巨大な配列) から必要な特定のポイントを持つ単なる配列です。

私の出力は以下の通りです:

   ...
   24.000231 ; flrarray
   23392 ; numbr_for_arr
   24.748374
   26612
   24.213783
   27473
   24.368324
   30637
   24.711283
   32432
   24.426823
   37675
   24.039426
   40733

flrarray の出力と postnflrarray

   ...       24.000231       24.748374       24.213783       24.368324       24.711283       24.426823       24.039426
   ...       23392           26612           27473           30637           32432           -27861          -24803

ご覧のとおり、numbr_for_array を出力してから追加するまでの間に何らかの方法で

37675 -> -27861 および 40733 -> -24803

なぜこれが起こっているのかについての洞察は大歓迎です。

flrarray 配列/ベクトルが外部ソースから来ていることを強調しなければならないので、このメソッドを使用して「del」配列内の場所を見つけます。

ご協力ありがとうございました

4

3 に答える 3

1

postnflrarray は「lonarr」である必要があります

つまり、postnflrarray=lonarr(N) ここで、N は配列の長さです。これは、16 ビットの符号付き整数 (最大サイズは約 32767) である配列の値に帰着します。それより大きい値を追加すると、オーバーフローして負になります。

于 2013-11-30T20:17:17.177 に答える
0

WHEREあなたが与えたものから、スカラーで使用しているように見えます。WHERE配列引数で使用したい。結果は、指定された条件に一致するインデックスを提供します。たとえば、 より大きい正弦曲線の要素を見つけるには、次の0.99ようにします。

IDL> x = findgen(360) * !dtor
IDL> y = sin(x)
IDL> ind = where(y gt 0.99, count)
IDL> print, count
          17
IDL> print, ind
          82          83          84          85          86          87          88          89
          90          91          92          93          94          95          96          97
          98
IDL> print, y[ind]
     0.990268     0.992546     0.994522     0.996195     0.997564     0.998630     0.999391
     0.999848      1.00000     0.999848     0.999391     0.998630     0.997564     0.996195
     0.994522     0.992546     0.990268
于 2013-12-02T03:13:56.053 に答える
0

コメントを付けて、コードを少し変更したバージョンを作成しました。

;;  If FLRARRAY is a one-dimensional array, then you could define the
;;    following outside of the for loop
;;  updn = [[flrarray - 1e-6],[flrarray + 1e-6]]
;for i=0,delta-1 do begin
for i=0L,delta-1L do begin
  print, flrarray[i]
;  numbr_for_arr=where(del gt ((flrarray[i])-0.000001) and del lt ((flrarray[i])+0.000001))
  ;;  Note:  WHERE.PRO should be returning long integers, not integers.  However, your
  ;;         output seems to suggest otherwise which is odd.
  numbr_for_arr = where(del gt (flrarray[i] - 0.000001) and del lt (flrarray[i] + 0.000001),nmb)*1L
;;  numbr_for_arr = where(del gt updn[i,0] and del lt updn[i,1],nmb)
  print,numbr_for_arr
;  postnflrarray[i]=numbr_for_arr  ;;  what if there is more than one element?
  if (nmb GT 0) then postnflrarray[i] = numbr_for_arr[0]
endfor
于 2014-09-28T16:14:57.710 に答える