The PIVMat Toolbox for Matlab contains a set of command-line functions to import, post-process and analyse 2- and 3-components vector fields from PIV (particle image velocimetry), stereo-PIV, DIC (digital image correlation) SS (synthetic schlieren) or BOS (background-oriented schlieren) applications.

Compatible with the most popular PIV softwares: DaVis (LaVision), DynamicStudio (Dantec), Insight (TSI), PIVlab, ImageJ (NIH), OpenPIV...

The PIVMat Toolbox enables to handle and perform complex operations over large amount of velocity fields (filtering, statistics, spectra etc), and to produce high-quality figures. This toolbox in itself does not perform any PIV computations.

Version 4.20 - 17 Jan 2021.

Online help   -  What's new?

Alternate download site here

This toolbox is covered by the BSD License.
Copyright (c) 2021, Frédéric Moisy. All rights reserved.

Main Features

  • Import vector fields from PIV (Particle Image Velocimetry) or other related technics, such as stereo-PIV, DIC (Digital Image Correlation), SS and BOS (Synthetic Schlieren and Background-oriented Schlieren).

  • Compatibale with files from DaVis (LaVision) DynamicStudio (Dantec), Insight (TSI), PIVlab, ImageJ (NIH), OpenPIV (Gurka & Liberzon), DPIVSoft (Meunier & Leweke), VidPIV (Oxford Laser), MatPIV (J. Kristian Sveen)...

  • Standard vector field operations: interpolation, filtering (median, Butterworth...), averaging (temporal, spatial, azimuthal...), derivatives (vorticity, divergence, strain, Q-factor...)

  • Fully vectorized: all operations directly apply on arrays of fields (no for loops)

  • More than 60 functions with full on-line documentation; sample fields included.

  • High-quality vector and scalar output based on Matlab visualization tools: 2D and 3D fields (meshes, surfaces...), movies (AVI), contour plots...

  • Advanced statistics: Histograms, correlation functions, vector and scalar structure functions, power spectra, integral scales, joint probability density functions...

  • Support for FS-SS (Free-Surface Synthetic Schlieren) applications for surface wave reconstructions (including production of random dot patterns)

  • Full support of DaVis files (VC7, IM7, IMX, EXP, SET) and file attributes (Acquisition times, PIV parameters...)

  • Works on all platforms: Windows/Unix/Mac.


The PIVMat Toolbox works with MATLAB 7 (R2006a) or higher, on every operating system (successfully tested up to Matlab R2017b, under Windows 7, 8 and 10).

PIVMat supports files from:

Some functions require the Image Processing Toolbox.

Installation procedure

1. Download the PIVMat Toolbox and extract the ZIP file in a folder, for example /Documents/MATLAB/toolbox/pivmat (make sure the subdirectories html, sample and private are correctly unzipped as well). Do NOT install in the Matlab application folder (typically /Program Files/Matlab/...). If you upgrade from an older version, first delete the previous pivmat directory.

2. If you wish to import DaVis files, download also the ReadIMX package available from the LaVision web site (with user registration).

3. In the 'Home' tab, select 'Set Path', click on 'Add Folder' (NOT 'Add with Subfolders') and select the directory pivmat. (Select also the directory readimx if necessary). Click on 'Save' and 'Close'.

4. To get started, type docpivmat.

Getting started

The first step is to import some vector fields into a 'PIVMAT structure array'. The simplest way to import data is to double-click on a file on the Current Directory Browser. You can also import data using the function loadvec. Each element of this structure array contains the two matrices of the velocity components, the coordinate system, and some additional informations (units, axe names, PIV parameters...). See this page for further details about PIVMAT structure arrays.

Once imported, the velocity fields can be displayed using showf, or converted into various scalar fields using vec2scal.

A sample directory, named sample, with 4 experimental series of PIV fields, is provided with the toolbox to test the following example. The example given below is based on DaVis 7 files (format VC7), but can be followed for other formats.

    v = loadvec('*.vc7');                % loads all the VC7 files
    showf(v);                            % displays the vector field movie
    showf(averf(v));                     % displays the ensemble-average
    plot(v(1).vy(:,20));                 % plots a horizontal profile of vy
    curl = vec2scal(filterf(v,2),'rot'); % computes the filtered vorticity
    showf(curl);                         % displays the vorticity movie
    movie2avi(showf(curl),'mymovie.avi');% saves it as an AVI movie
    histscal_disp(curl);                 % displays the vorticity histogram
    statf(v)                             % computes some statistics
    specf(v)                             % displays the power spectra

See the Online help and the FAQ for more examples, or type  docpivmat  in Matlab.

How to acknowledge?

Go to the PIVMat page on the Matlab Central and offer a 5-stars rating!

User Community

This toolbox is used by several laboratories and universities worldwide since more than 10 years.

If you want to submit suggestions, comments, bug reports, or if you wand to receive upgrade informations, please feel free to send an email to the author.

Earlier versions (27 feb 2017) (23 may 2016) (26 apr 2016) (17 feb 2015) (25 jun 2013)
Older versions


PIVMat page on the Matlab Central.

Author's home page.

Author's Matlab page.

This page is hosted by FAST
Last update: 17 jan 2021.