DataSetにある単一要素のインデックス
このタイプの方式は、DataSetを利用する際に詳細な制御を必要とする場合に使用します。また、要素を直感的に利用できる方法にもなっています。
nearField[1][1][1][1].EFieldComp1 = nearField[1][1][1][1].EFieldComp1 * 2
上記のコマンドは、空間でインデックスを持つ最初の点で、最初の周波数における値 に乗算を実行します。すべての軸をループ処理することにより、軸のインデックスに基づいて特定の値を選択的に変更できます。次の例では、 を超える距離だけZ 軸から離れているすべての電界を0に設定しています。このスクリプトをmodNF_indiv.luaとして保存し、今後も使用できるようにします。
-- Create the near field dataset nf = pf.NearField.GetDataSet("Horn.StandardConfiguration1.NearField1") for freq = 1, #nf.Axes[1] do for xPos = 1, #nf.Axes[2] do for yPos = 1, #nf.Axes[3] do for zPos = 1, #nf.Axes[4] do if ( math.sqrt(nf.Axes[2][xPos]^2 + nf.Axes[3][yPos]^2) >= 0.15 ) then nfPoint = nf[freq][xPos][yPos][zPos]; nfPoint.EFieldComp1 = 0 + 0*i nfPoint.EFieldComp2 = 0 + 0*i nfPoint.EFieldComp3 = 0 + 0*i nfPoint.HFieldComp1 = 0 + 0*i nfPoint.HFieldComp2 = 0 + 0*i nfPoint.HFieldComp3 = 0 + 0*i end end end end end return nf