F = loadvec(FILENAME) loads the vector/image fields matching FILENAME
into the structure array F. Supported file formats are:
.VEC Vector field from DaVis 6.
.VC7 Vector field from DaVis 7.
.IMX,IMG Image from DaVis 6.
.IM7 Image from DaVis 7.
.TXT Vector field exported in TXT mode (see loadpivtxt)
.SET Set of vector fields (see loadset for details)
.MAT Any MATLAB file containing a valid structure array of
vector/scalar fields (e.g., files converted by vec2mat,
or the file 'set.mat' generated by loadset).
.CM0,UWO Vector field from Optical Flow.
A file may also be loaded by clicking on the Current Directory browser
(but multiple file selection is not allowed).
The resulting structure array F can be displayed using showvec or
showscal. Use vec2scal to compute scalar fields from vector fields.
If FILENAME is a cell array, (e.g. {'B1.vec','B2.vec'}), then loadvec
loads all the files in the structure array F. Wildcards (*) may be used
(e.g., loadvec('B*.vec')). Brackets ([]) may also be used (see expandstr
for details). For example, F = loadvec('B[2:2:6].vec') loads the files
'B00002.vec','B00004.vec', 'B00006.vec'.
To load directly all the vector/image fields of a directory, see loadset.
F = loadvec(NUM) loads the file number NUM from the current directory
(works in alphanumeric order, only for VEC/ VC7 and IMX/IM7 files).
NUM may be a simple number or any valid MATLAB vector (e.g., 1:10,
[1 10], 2:2:8, 10:-1:1, etc.)
For multi-frame images, F = loadvec(FILENAME, 'frame', N) returns only
the frame N.
loadvec without input argument first opens a dialog box for file
selection.
loadvec(...,'verbose') displays the file name being loaded.
loadvec file_name or loadvec('file_name') without output argument is a
shortcut for showf(loadvec('file_name')).
For vector fields, the structure F contains the following fields:
x,y: vectors containing the X and Y coordinates
vx,vy: matrices of the x and y components of the velocity
ysign: string, upward or downward Y axis
namevx, unitvx, namex, unitx...: strings
name: name of the VEC/VC7 file from which originates V
setname: name of the parent directory (called 'SET' in DaVis)
Attributes: Additional informations from DaVis (see getattribute)
choice: An array of 6 integers, giving the 1st, 2nd, 3rd, 4th
choice vectors, the number of filled/processed vectors
and the number of missing vectors.
history: Remind from which command V has been obtained
For scalar fields, vx and vy are replaced by w (idem for namevx,...)
Examples
loadvec B00001.vc7
showvec(loadvec('*.vec'));
showscal(vec2scal(loadvec('B00001.vc7'),'rot'));
v=loadvec('B[2:2:6]*.v*');
v=loadvec({'data1.set','data2.set'});
v=loadvec(1:10);
v=loadvec('*','verbose');
Note: When used with DaVis files, loadvec works only under Windows
32-bits edition. See vec2mat to convert DaVis files into Mat-files in
order to load them on other plateforms (Windows 64-bits, Linux, Mac...)
See Also
showvec, showscal, showf, loadset, loadarrayvec, vec2mat,
filterf, vec2scal, batchf, expandstr, rdir, zerotonanfield,
nantozerofield.