0

I have an array with several files in it. And i want to loop through these files. For each file i want to run a command.

result = [rtlvis_20190518_13.35.48_00001.bin, rtlvis_20190518_13.35.48_00002.bin, rtlvis_20190518_13.35.48_00003.bin, rtlvis_20190518_13.35.48_00004.bin, rtlvis_20190518_13.35.48_00005.bin]

something like: for each file in result run the following command read_rtlvis_v12,a,c,t,g,FILE="file",/CFILEONLY Where file is each one of the files in result

Ive tried the following

FOREACH file, result do begin read_rtlvis_v12,a,c,t,g,FILE="file",/CFILEONLY

The error i get is in the read_rtlvis_v12 code. But my question is, is this the right way to go about doing a for loop with this kind of command.

Am i setting FILE="file" correctly, where file is each one of the files in result.

mgalloy
  • 2,356
  • 1
  • 12
  • 10
ColleenB
  • 135
  • 5
  • 19

1 Answers1

3

Do not use quotes around "file" — that is trying to read a file literally named "file". Use:

foreach file, result do read_rtlvis_v12, a, c, t, g, FILE=file, /CFILEONLY
mgalloy
  • 2,356
  • 1
  • 12
  • 10