Code covered by the BSD License  

Highlights from
UFF File Reading and Writing


4.8 | 18 ratings Rate this file 91 Downloads (last 30 days) File Size: 133 KB File ID: #6395
image thumbnail

UFF File Reading and Writing



26 Nov 2004 (Updated )

Reading and writing of ascii files in Universal File Format (UFF).

| Watch this File

File Information

UFF bundle contains 2 functions, one for reading (readuff) and one for writing (writeuff) of ascii and binary files in Universal File Format (UFF). Although there are many different data-sets that can be stored in UFF files in general, only data-sets 58, 58b, 15, 82, 2411, 2412, 151, 164, and 55 are supported (2411 and 2412 for reading only). These data-sets are frequently used in structural dynamics.
From February 2011 the code is hosted at


This file inspired Bruel & Kjaer Pulse Labshop Measurement Organizer Exporter.

MATLAB release MATLAB 7 (R14)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (26)
14 Nov 2014 Lehtym

There is a bug in reading dataset 58b.
If first byte of binary block corresponds to newline character it is skipped and block is considered to have incorrect length. Consider the following fix.

1) introduce
ind_bb1 = blockLines(11,2) + 3; % index of first byte of binary block

2) replace where appropriate blockLines(12,1) by ind_bb1

17 Jun 2014 John Anderson

I found that the binary uff 58 file read in and then written out from MATLAB could not be read into nCode or Head Acoustics Artemis. Problem appears to be in header section formatting. I can send you a screen shot of the comparison using gvim.

27 May 2014 Grzegorz  
12 Jul 2013 Jianliang Wang

there a field named "ordDenomDataChar" in the writeuff.m, but there is not a same field in the readuff.m
when I want to write a chaged uff structure, I should to added it.

12 Jul 2013 Jianliang Wang  
27 May 2013 Primoz Cermelj

Fixed the issue Ozan pointed out, i.e., using numpt.

26 Apr 2013 Ozan Oguz

There is a mistake in the extract58 data reading, which causes wrong plotting.

Instead of using "end-1" and "end" values to fill "measdata" and "x" values (((i.e. UFF.x = values(1:2:end-1);))), you should use "numpt" which is defined already as the number of measured data points.

This is neccessary in some uff recordings, as there are extra "zero" values at the end of the recorded data, which are not real measured data and used only to complete the columns and lines of UFF or UNV recording. Using "end" causes you to have these false data points.

See this:

% Abscissa and ordinate values
if (ordDataType == 2 || ordDataType == 4)

% non-complex ordinate data
if spacingType == 0 % uneven abscissa
UFF.x = values(1:2:end-1);
UFF.measData = values(2:2:end);
else % even abscissa
UFF.measData = values;
nVal = length(UFF.measData);
UFF.x = UFF.xmin : UFF.dx : UFF.xmin + (nVal-1)*UFF.dx;
elseif (ordDataType == 5 || ordDataType == 6)

% complex ordinate data
if spacingType == 0 % uneven abscissa
UFF.measData = values(2:3:end-1) + j*values(3:3:end);
UFF.x = values(1:3:end-2);
else % even abscissa
UFF.measData = values(1:2:end-1) + j*values(2:2:end);
nVal = length(UFF.measData);
UFF.x = UFF.xmin : UFF.dx : UFF.xmin + (nVal-1)*UFF.dx;
errMessage = ['error reading measurement data at:' num2str(lineN)];


22 Mar 2013 Ozan Oguz


I am trying to read a UFF58 data. I can only plot the "data description" part, but couldn't manage to plot the measurment data.

Can you give a hint please? Is it possible at all?

Thank you!

26 Feb 2013 AlexG

Great program, thanks.

it does not work to read a certain data type only with readuff.m . Please consider replacing:
if ~find(dsTypes==data_set_type)
if dsTypes~=data_set_type

And moving:
dataSetN = dataSetN + 1;
just before:
UffDataSets{dataSetN} = ds_data;


08 May 2011 ehs  
15 Mar 2011 oddo

I have found an excel sheet for reading uff file here :

04 Jan 2011 Jake Zwart

I had problems reading binary data into Ideas, so added single precision write capability and now it works.

21 May 2009 Tom Cunningham

If I ever get to Europe, you pick the spot and I'll buy dinner! And if you ever get to Pittsburgh, I know where to eat and I'm still buying. Thanks again for a very useful program! It is the cornerstone of my vibration post-processing GUI.

18 Jul 2008 Ryan Edwards

Thank you for this function. You also saved me a lot of work. As much as I would enjoy writing a function to read uff files, I just didn't have the time for this particular task I was working. Thanks again.

04 Jan 2008 Seshagiri Rao Maddipati

Very cool. U saved me lot of work. Thank you so much. now i can transfer data from Onosokki to CADA-X through matlab

19 Oct 2007 Miguel Colomo

I used it to read UFF data and create data from Matlab to CADA-X /LMS software. It was incredibly useful

13 Jun 2007 Ryan Dolan

Wow... I am in your debt. You just saved me a ton of work.

04 May 2007 John Anderson

I tried it on a .unv file output from LMS Virtual.Lab with results from a modal test (format 55). It works fine. This just saved me at least a day to write my own. Very cool!

25 Apr 2007 Helene Illaire

Worked fine on Universal ascii 58 type of data (imported from Cada-X LMS).

15 Feb 2007 Thomas Cunningham

Using ver. 0.9.9b2, I have read 58b data embedded in a proprietary file format that was actually a universal file with added data- this reader still managed to extract the data, so I'm not sure what your problem might be. I stand by my 5 stars for now, good luck!

25 Jan 2007 Yiu Luk

I don't seem to be able to read Universal binary 58b type of data. The ASCII part seems OK.

05 Jun 2006 Thomas Cunningham

Worked wonderfully on IOTech's Zonicbook 618 universal files. I embedded it in a calling function & graphed reams of spectra in minutes. Good work!

10 Jun 2005 scott reilly

our instrument (polytec laser) kicked out a file that had invisible carriage returns in the windows environment. these had to be stripped out of the data file so that this m file could read the data.

21 Apr 2005 Frantz JOURDA

Exactly what I was looking for. Tanks you Primoz, you're a star !

15 Feb 2005 Ray Martell

Nice of the better ascii uff writers/readers i've seen.

14 Feb 2005 Matt Allen

Great program. Thanks!

01 Dec 2004

Update; full m-code available

17 Jan 2005

Update (speed improvement)

20 Jan 2005

minor update

04 Mar 2005

164 data-set related bug removed

23 May 2005


20 Jun 2005

Update: the hybrid (ascii-binary) format 58b is now supported; some minor changes to remove some bugs

26 Jan 2006

Update; uneven abscisa data can be read/written

30 Jan 2006

Minor bug removed (even abscisa-values field was twice as long as it should be when reading 58 data-set)

06 Jun 2006

able to read only a portion of the unv file

03 Aug 2006


04 Aug 2006

another fix for 58b data-set

09 Jan 2008


11 Mar 2008

datasets 2411 and 2412 added to readuff

11 Mar 2008

Description update

13 Mar 2008

a minor bug fixed

09 Nov 2008

minor update

20 May 2009

license update

20 Jun 2009

License update

17 Jul 2009

license change

11 Apr 2010

Minor fix

20 Jul 2010

1858 data-set added to writeuff

30 Aug 2010

Minor fixes

30 Aug 2010


23 Feb 2011

Description changed

18 Jul 2012

Minor fixes

27 Feb 2013

Minor fixes

27 Feb 2013


28 May 2013

Minor fix in readuff

24 Nov 2014

Fixed bug when writing data-set 55 (dataType not taken into account properly in special cases).

Contact us