Page 1 of 1

opening multiple data files using macros

Posted: Wed Apr 02, 2014 10:22 pm
by nipunarora088
I have to handle many data files and on each file i have to perform similar functions for which i have already written a macro script. The name of the files are in the numerical order like "plunging_1.plt", "plunging_2.plt","plunging_3.plt",,,,,.

#!MC 1200
# Created by Tecplot 360 build 12.0.0.4231
$!VarSet |MFBD| = 'C:\Program Files (x86)\Tecplot\Tec360 2011\bin'
$!READDATASET '"H:\Plunging_membrane\codes\newman\22_3_14\plunging_1.plt" '



Is it possible to open these files using a for loop instead of opening each file individually and then executing the same commands.

Re: opening multiple data files using macros

Posted: Thu Apr 03, 2014 6:50 am
by salter
Absolutely. Since you know the name of the file, and a digit that changes from file to file in succession, you can develop a macro that regenerates the next file name. In fact, if the file name change is not even numeric, there is still a way to reconstruct a file name in succession but that is more involved.

For your situation, you can use something like:

Code: Select all

$!VarSet |NumFiles| = 102
$!Loop |NumFiles|
  $!ReadDataSet  '"H:\Plunging_membrane\codes\newman\22_3_14\plunging_|loop|.plt" '
...
# Perform rest of macro
...
$!EndLoop

Look at $TEC360HOME/doc/tecplot/tprm.pdf for more information on looping and text use. By default, each instance of any variable is always a text string. It is only when the contents are numeric will it be converted if the context makes sense for the command being used.


Good Luck,

Re: opening multiple data files using macros

Posted: Thu Apr 03, 2014 8:49 am
by nipunarora088
Thanks Steve. This will save a lot of time. Thanks a lot

Re: opening multiple data files using macros

Posted: Fri Apr 04, 2014 6:55 am
by salter
You are most welcome.