0

例(2009年作成)から読んで、2列のデータを持つ.datファイルを作成しました。temperature_vs_current.datこの例では、次の方法でファイルを IDL に読み込む必要があります。

IDL> iplot, temperature_vs_darkcurrent.dat

しかし、これは戻ります

% Expression must be a structure in this context: TEMPERATURE_VS_DARKCURRENT.
% Execution halted at: $MAIN$    

入力をどのようにフォーマットすればよいですか?ここでのエラーは何ですか? これは IDL バージョン 6.0 です。

4

1 に答える 1

1

( thisthisから派生した当て推量に従います。)明らかに、iplotファイルではなく配列引数が必要なので、次のようなものを試すことができます。

N = 10                ; number of data pairs in the .dat file
xy = fltarr(2,N)      ; create empty 2xN array
openr, 1, 'temperature_vs_darkcurrent.dat' ; open file
readf, 1, xy          ; file content ~~> array
close, 1              ; close file
x = xy(0,*)           ; separate pairs into x...
y = xy(1,*)           ; ...and y
iplot, x, y           ; iplot
end 

これは出発点にすぎません。もっと便利な方法があるかもしれませんが、私にはわかりません。

于 2011-11-10T12:56:01.097 に答える