Execute PIVMat functions over a series of files
RES = batchf(FILENAME,FUN) executes the function FUN for each file
matching FILENAME. Wildcards (*) and brackets () may be used (see
rdir). This is formally equivalent to calling the function FUN
with the argument loadvec(FILENAME), except that the fields are not
stored into memory, but are processed from disk one by one by the
function FUN. This is useful for handling a large number of files
which cannot be stored into a structure array for lack of memory. All
the file formats supported by loadvec are also supported by batchf.
The result RES is an array whose elements are the output of the
function FUN applied to each file matching FILENAME.
RES = batchf(FILENAME,FUN,ARG) also passes the argument(s) ARG to
the function FUN. This is formally equivalent as FUN(loadvec(...),ARG)
(this works only for simple arguments, as strings and numbers, not for
arrays and cell arrays).
RES = batchf(..., 'nodisp') does not display the function call for
each file matching FILENAME in the command window.
st=batchf('set*/B00001.VEC','statf') calls the function statf for
each file B00001.VEC in each directory matching 'set*'.
batchf('set*/B*.VEC','showf','rot',8) is equivalent to
showf(loadvec('set*/B*.VEC'),'rot',8), except that the files are
not stored in a structure array.
If the function FUN to be executed is more complex, you may create a
M-File called 'myfunction.m', that contains the complex computation to
be executed for each field V, and to execute RES =
Create the following M-File called 'enstrophy.m':
function z = enstrophy(v),
stat = statf(vec2scal(filterf(v,1),'rot'));
z = stat.rms^2;
z = batchf('set*/*.vc7','enstrophy');
loadvec, loadarrayvec, rdir.
Published output in the Help browser
2005-2021 PIVMat Toolbox 4.20