akis
akis

Reputation: 154

open folder with ctl files in grads

can you i'm having trouble opening multiple ctl files in grads.

The folder contains 20 ctl files and i'd like not to open them one by one.

Unfortunately open pathfolder does not work. Any ideas please?

Upvotes: 0

Views: 504

Answers (1)

ExHunter
ExHunter

Reputation: 307

Let's say your ctl files are of the form sample1.ctl, sample2.ctl, sample3.ctl... sample9.ctl. The script would look something like

i = 1
while ( i <= 9 )
  'open sample'%i
  'd u'
  'd v'
  'reinit'
  i = i + 1
endwhile

Note that if you don't "reinit" you'll have to specify the variable from each ctl file (e.g., instead of just 'd u' it would be 'd u.1' for the first file, 'd u.2' for the second, and so on. Also, without a reinit you could run out of memory. Also, you might have to add some if/then lines for cases like "sample01.ctl", e.g., "open sample0'%i" if i is less than 10. Hope that works.

Upvotes: 2

Related Questions