batch process dat files of different names to plot graphs

November 3, 2012 at 02:46:01
Specs: Windows XP
i want to create a bat file to read a txt file containing a list of file names.
say, list.txt --The file names in the list are dat files.

Now how do i get a bat file to call a plotting application's script (extension is *gnu) and
1. replace a word all over the plotting script with that file name in the list
2. run the script calling the plotting app

repeat this process (in a loop) until all the files in list.txt have been read and plot


See More: batch process dat files of different names to plot graphs

Report •


#1
November 3, 2012 at 06:53:03
I can do all of that easily, but what do you mean by the "plotting script" that needs to be run?
So far what i've concluded is, you want to read a file in this case list.txt
line by line, each time individually, then replace x with the current file name, and then run the script calling the plotting app and go through a loop.
Be more descriptive please.

Report •

#2
November 3, 2012 at 18:09:45
Yeh, if you could post a copy or simulacrum of the "plotting application's script ", and indicate the word that needs replaced (unless it's obvious from the context), that would be very helpful.

Report •

#3
November 5, 2012 at 06:54:18
okay! i'll try describe better

the gnu plot script is simple(below).. i want to load this script into gnuplot many times with a particular variable replaced with one from list.txt, each time.

set xlabel..ylabel...
..
plot 'filexxx\soln\1_5\curve.dat' u 1:2 w lp ls 1 t '@1.5', \
'filexxx\soln\3m\curve.dat' u 1:2 w lp ls 2 t '@3.0', \
'filexxx\soln\6m\curve.dat' u 1:2 w lp ls 4 t '@6.0', \
'filexxx\soln\9m\curve.dat' u 1:2 w lp ls 5 t '@9.0' \

'filexxx'-the variable is a foldername within it are subfolders leading to curve.dat
And there are many folders like filexxx of different names - so im treating it as a variable. 'list.txt' contains the list of all file names to be replaced for filexxx - each time the ploting script is run.

seems i made errors with wut i explained earlier (sorry) 'm a total newbie.. thanx


Report •

Related Solutions

#4
November 5, 2012 at 10:49:48
This might serve as a "conversation starter":

::======= begin batchscript
@echo off & setlocal enabledelayedexpansion
for /f "tokens=*" %%a in (list.txt) do (
echo off>ofile
call :repl
:: see if this looks right...
more ofile
pause
)
goto :eof

:repl
for /f "tokens=*" %%b in (plotscript) do (
set line=%%b
>>ofile echo !line:filexxx\=%%a\!
)
::==== end batchscript

if the plot script is a batchscript, then you could replace all
'filexxx\
with
'%filexxx%'

and then set var filexxx to each line of list.txt and call gnuplot, which script will substitute in the value for %filexxx%


Report •

#5
November 5, 2012 at 20:26:11
okay! i'll try describe better
the gnu plot script is simple(below).. i want to load this script into gnuplot many times with a particular variable replaced with one from list.txt, each time.

set xlabel..ylabel...
..
plot 'filexxx\soln\1_5\curve.dat' u 1:2 w lp ls 1 t '@1.5', \
'filexxx\soln\3m\curve.dat' u 1:2 w lp ls 2 t '@3.0', \
'filexxx\soln\6m\curve.dat' u 1:2 w lp ls 4 t '@6.0', \
'filexxx\soln\9m\curve.dat' u 1:2 w lp ls 5 t '@9.0' \

'filexxx'-the variable is a foldername within it are subfolders leading to curve.dat
And there are many folders like filexxx of different names - so im treating it as a variable. 'list.txt' contains the list of all file names to be replaced for filexxx - each time the ploting script is run.

seems i made errors with wut i explained earlier (sorry) 'm a total newbie.. thanx


Report •

Ask Question