File Exchange

image thumbnail

PIVMat 4.10

version (5.45 MB) by Frederic Moisy
A PIV Post-processing and data analysis toolbox


Updated 21 Mar 2018

View Version History

View License

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.
It is compatible with several data formats, including DaVis (LaVision) and DynamicStudio (Dantec).
The PIVMat Toolbox enables to handle and perform complex operations over large amount of velocity fields, and to produce high-quality vector/scalar outputs. This toolbox in itself does not perform any PIV computations.
Main Features:
- Import vector fields from PIV (Particle Image Velocimetry) or other related technics, such as DIC (Digital Image Correlation), SS and BOS (Synthetic Schlieren and Background-oriented Schlieren).
- Compatibale with files from DaVis (LaVision GmbH), DynamicStudio (Dantec), DPIVSoft (Meunier & Leweke), VidPIV (Oxford Laser), MatPIV (J. Kristian Sveen) and Optical Flow.
- Standard vector field operations: interpolation, filtering (median, Butterworth...), averaging (temporal, spatial, azimuthal...), derivatives computation (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 (VEC, VC7, IMX, IM7, EXP, SET) and file attributes (Acquisition times, PIV parameters...)
- Works on all platforms: Windows/Unix/Mac.

See for the installation procedure.

Cite As

Frederic Moisy (2021). PIVMat 4.10 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (65)

anoop p

Thank you very much , It was very helpful in my research

Petr Michalek

pivmat 4.10 does not work in my Matlab R2017b. When I try to use loadvec for DynamicStudio *.dat files, I get:
>> loadvec
Error using zeros
Size inputs must be integers.
Error in loadpivtxt (line 84)
Error in loadvec (line 661)
newv = loadpivtxt(filename{i}); % changed v1.52

Please help to get this working. Thanks. Petr

Fernando Zigunov

Martin Bremm

I discovered an error when using the RDIR() function. It is not possible to define the cell array of strings in the form [N1 N2 N3..] as it is sugested in the help text of the EXPANDSTR() function.

check Revision 1.10:
% For example, expandstr('B[1 2 3,5]*.*') returns {'B00001*.*','B00002*.*',..}. Note
% that EXPANDSTR is automatically called from RDIR.

However using a range to define the cell array works: expandstr('B[1:3,5]*.*')

How is it possible to define the cell array by an enumerated vecor i.e. [01 05 06 07]?

Pece Manovski

Is there any chance of updating for Readimx v2.1.8? The current version is not compatible. Great app - I have used it for past versions of Readimx.

Andrea La Spina


Any ideas on how to make it operate with Dantec ".image" or ".vectors" file extensions?

This works great for LaVision! Thank you!

Tom Wester

Daniel Moore

Martin Bremm

Maxime Harazi

For the ncorr users, here is a simple function that converts ncorr output files to PIVMat files :

Maxime Harazi

Farzan Kazemifar


Alex Liberzon

Dear Frederic,

great job. please add

and it'd be lovely if you could also mention our OpenPIV - we use it a lot. (both Matlab and Python versions release also VEC files like Insight 3G/4G from TSI)

Sitthipong Yapo

Fernando Zigunov

Jordan Thomas

Using this on Matlab R2017b with DaVis 8.2 and it works flawlessly! This is a great time saver, thanks so much for this.

Dan Fries


Hi! I also get an error message "Attempt to execute SCRIPT readimx as a function", working on MATLAB R2016b. I add the path with the readimx.dll file right, what could be the problem?

Daniel Moore


thank you very much

mohammad karami

Aswin Muralidharan

I enjoyed PIVMat a lot. I want to know if it is possible to export the structure output of loadvec to tecplot readable format?

Jasmeet Singh

Antoine HECTOR


Is PIVMat 4.00 or 4.01 compatible with Matlab 2015a, 2015b, or 2016. Are there any known issues?


Frederic Moisy

Dear PIVMat users,
PIVMat 4.00 is now compatible with LaVision ReadIMX 2.
F. Moisy

Ashley Jones


I am currently using PIVMat 3.03 on MATLAB 2015a. Yes, I am aware of compatibility issues but bare with me. I am currently running:
Windows 7, 64-bit
MATLAB 2015a
PIVMat 3.03
ReadIMX v1 (for matlab 2007a to 2014b)

My current problem is when I save a figure, it gives the error "Error using < Matrix dimensions must agree." Any figure type saved either doesn't save or is corrupted. I have been told it might be a graphics issue, but I am sure the compatibility issues aren't helping either.

I just wanted to mention this and if anyone knows a work around, let me know.

Frederic Moisy

Dear Adama, Emir, Chris,

Yes, Pivmat is compatible with Matlab 2014b. But it is not compatible with readimx 2.0 (not yet...) You need to install the previous release of readimx, which can be found here

Sorry for the inconvenience


is this version also compatible with Matlab 2014b?

On the website "" it says that it was tested up to R2013b, Matlab 8.1 but anyway i would like to ask you if anyone tried this on the actual version (2014b).


Adama creppy

Thank you Chris for your contribution, but it stills a problem. i've modified my to point to the proper location but what about the -desktop argument?
here is what is in my #!/bin/sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:$/home/acreppy/Desktop/Mes_dossiers/Mes_codes/Matlab_tools/readimx_v2.0_glnxa64/readimx.mexa64
exec /PRODCOM/bin/matlabr2013a

and i have this error message
Invalid MEX-file
'/home/acreppy/Desktop/Mes_dossiers/Mes_codes/Matlab_tools/readimx_v2.0_glnxa64/readimx.mexa64': open shared object file: No such file or directory"

Can you help me?


For those of you receiving an "Invalid MEX-file" error, you need to execute the following code:


Alternatively, you can launch MATLAB using the included shell script ( in the readimx/tools folder. I had to modify mine to point to the proper location and include the -desktop argument.


Not sure if this is the best place to ask: Has anyone had success intalling ReadIMX for Matlab 2013b on Ubuntu 12.04LTS? I have having problems which feel like they should be an easy fix: I get this error
"Invalid MEX-file '/home/daniel/Documents/MATLAB/readimx/readimx_v2_linux/readimx.mexa64': cannot open shared object file: No such file or directory"

Does this mean it cannot locate the library or that something is out of date?


Like some other have have previously commented here, I had the problem that I couldn't find the downloads>software link from
The reason is that you have to register AND include the Davis software dongle number in your profile. This should automatically give you customer status and will have access to more services - if not automatically, all it takes is a message through lavision's contact form and they will upgrade your status (at the provision of a valid dongle key - which you can by the way find by opening your DaVis version Help>About: there you'll see the Donlge #).


Carlos Reche

I have found a problem using readimx. I downloaded readimx.dll and readimx.m and installed it following the intructions. However, when I run loadvec I get an error which says:

??? Attempt to execute SCRIPT readimx as a function

I have seen that readimx.m has been not created as a function and it has only commented lines.
My versión of Matlab is 2010b 64-bit, but I have used this version of readimx before with other versions of matlab without any problem.

Can anybody help me??


Hi Hassan,
I am not sure if you found it already but you need to login to the LaVision website and then go to downloads and the file is under software->DaVis add ons.



I need ReadIMX / MatlabIMX from LaVision in order to import Davis files when using PIVMat. However, I can't find it on the LaVision website anywhere. It seems like they've taken it down, and I can't find it anywhere else. Can anyone point me in the right direction or provide a copy?


This was asked by Anthony on 12 Sep 2012 on the Questions/Answers section.


I just read the previous comment about indexing difference between PIVMat and Matlab. I was wondering if you can try modify it for the next version. I was lucky to realize that the data point I had chosen was different.


Frederic Moisy

Dear Maxwell,
This is because different matrix indexing conventions are used in Matlab and PIVMat.
This point is explained here:
see the section "Matrix indexing"
I hope this helps,


I've noticed that when I import a .VC7 file and view the v.x and v.y fields, (in my case 1x100 and 1x75, respectively) their dimensions don't agree with the dimensions of v.vx and v.vy.

So, the vector field is 75x100 (#rows x #cols), as it should be, and I would expect the v.vx and v.vy to be the same. However, v.vx and v.vy turn out to be 100x75. It appears to be the transpose.

Does anyone agree with me?

On the online help, it says that v.x and v.y should be 1xM and 1xN respectively. It then says that v.vx and v.vy should both be MxN. The problem is, I find them to be NxM instead.

To fix the problem,I've just transposed them for my analyses, but I'm not completely confident now. Anyone have any ideas? Thx!

Nicolas Gautier

Works wonders, very useful for handling davis file types.

W. Ethan Eagle

I have updated a version of this code to work with 3D vc7 files. Not all functions are currently supported.

However,loadvec averf vec2scal extractf filterf subaverf and interpf are, among others.

The code is designed to remain compatible across 1-D,2-D and 3-D vectors, by using the 'isfeild' function to search for Vc7.vz to a bool entitled 'Dim3'

With the author's permission I am happy to share.



I would like to use the renumberfile feature, but with variable input, for example, renumberfile('B[1:1:n].im7','B'), where n is determined by input. When I do this, I get an error message. Any ideas?


Please ignore my previous comment; here is the corrected version: I would like to use the renumberfile feature, but with variable input, for example, renumberfile('B[1:1:n].im7','B'), where n is determined by input. When I do this, I get an error message. Any ideas?

Frederic Moisy

Dear Avanish, Jianan, Mohamed,
Thank you for your comments. I have posted a new version (PIVMat 2.01), which now fixes this issue. Now PIVMat is now compatible with the latest release of the ReadIMX package.


Hi Mohamed,

I think follwing is the reason of its problem and solution is also given below: (I wrote this email to Dr. Moisy)

I have downloaded the latest version of pivmat 2.0 and readimx file: Readimx for Matlab 7.4 (R2007a) to 7.11 (R2010b) under Windows 32 bits (XP, Vista, 7).

However, when we put everything together and issue loadvec command it says: Obsolete version of ReadIMX - Please upgrade.
See the step 1 of the Installation Instructions.

For a new user like me it is very confusing. I then did a little bit of research in your code of loadvec and I found that error happens due to this piece of code (repeated twice) in loadvec function:

if ~checkreadimxversion(a,7)
disp('Obsolete version of ReadIMX - Please upgrade.');
disp('See the step 1 of the <a href="matlab:docpivmat pivmat_install">Installation Instructions</a>.');
clear v

Now checkreadimxversion determines the version of current readimx code by operating on the string:


ans =

$Version: 1.5$ $Date: 15.12.2010$ $Revision: 2 $

Now problem with the code of checkreadimxversion is that it extracts numeric value after 'Revision:' but fails to take in to account the numerical value after Version. New readimx code says version 1.5 and revision 2. But the code picks up only revision 2 and compares it with your specified value 7, hence it gives error message. It worked fine with earlier package of redimx (for example: readimx4matlab_v1.4) because their output was:


ans =

$Version: 1.0$ $Date: 8/06/07 16:38 $ $Revision: 6 $

I hope now you see the bug in code. Quick fix solution will be to change arugument of checkreadimxversion in loadvec.m file to checkreadimxversion(a,1). This is needed to be changed at two lines in loadvec.m file: line number 292 and 423.

Better solution will be to modify the function of checkreadimxversion in such a way that it also inlcudes version, not only the revision number.

Dr. Moisy is the best person to comment on this. but it seems to me the reason for error message.

Hope it will help you, Avanish

Mohamed Hatem

I also just downloaded the latest version of readimx package
- readimx.dll released in March,3rd 2011
- readimx.mex and showimx.m released in Dec,15th 2011
- readimx.m released in Oct,10 2005
It does not work (obsolete version please upgrade)
Thanks for helping


Hi, I just downloaded this package. But it seems not working with the new version of ReadIMX which released in Dec 2010. Thanks.

Thomas Clark

In addition to my last comment, the readIMX pacakge is now available for linux platforms too. So it might be worth commenting out the test for whether you're using a win32 platform, as it stops people using the linux version. Maybe put in a warning instead?


Tom Clark

Rahul Mulinti

Thanks for the input, worked great. Saved me lot of time.

Frederic Moisy

Dear Rahul,
Yes, just do the following
im = loadvec('B00001.im7');
hist(im.w(:),N); % N is the number of bins.
I hope this helps,

Rahul Mulinti

I am trying to use PIVMAT to extract just the intensity information from a raw .im7 file from DaVis. I want to plot the intensity histograms and pdfs. Is there any way to do it with PIVMAT?

very good

Hans Henrik Mortensen

Really nice work

Tom Clark

Great toolbox, this takes a big chunk of time out of my PhD... Maybe I can finish earlier; or procrastinate more!

Claudia Hofemann

Dear Frederic Moisy,

every time I try to run V = LOADSET('set') I receive the error note "Undefined function or variable "vv".
Error in ==> loadset at 172 v=vv " . "set" is a folder with *.VC7 files. If I try load one of the files with loadvec - it works.

I would be very happy about a advice, how to get loadset running.

Thanks a lot

F Moisy

Dear Claudia -- No, at that time PIVMat only supports 2D VC7 files. -- The author

Claudia Hofemann

Hi, I just started to use PIVMat and I am wondering if it is also posiible to work with 3D .VC7 files.

Frederic Moisy

The problem encountered by Zac Nagel originates from a buggy release of the LaVision's ReadIMX 1.4 package. If you have the March 2006 release of ReadIMX1.4, please upgrade it (see, Download > Davis Tools > MatlabIMX1.4). It should work. --The author.

Zac Nagel

I followed the directions clearly and the it gives me "out of memory" errors. My PC has plenty of memory and I'm not running any other programs.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!