Reputation:
Reading from an example (created 2009), I have created a .dat
file called temperature_vs_current.dat
with 2 columns of data. The example says I should then read the file into IDL via
IDL> iplot, temperature_vs_darkcurrent.dat
but this returns
% Expression must be a structure in this context: TEMPERATURE_VS_DARKCURRENT.
% Execution halted at: $MAIN$
how should I format my input, and what is the error here? This is IDL Version 6.0
Upvotes: 0
Views: 1614
Reputation: 602
(It follows guesswork derived from this and this.) Apparently, iplot
needs array argument(s), not files, so you could try something like this:
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
This is just a starting point, there might be more convenient ways, I have no idea.
Upvotes: 1