Code covered by the BSD License  

Highlights from
MDF Import Tool and Function

4.32143

4.3 | 30 ratings Rate this file 166 Downloads (last 30 days) File Size: 38.1 KB File ID: #9622
image thumbnail

MDF Import Tool and Function

by

 

13 Jan 2006 (Updated )

GUI tool and function to import signal data from MDF (Measure Data Format) files

| Watch this File

File Information
Description

This tool and function imports data from v3.0 MDF (.dat or .mdf) files to the MATLAB® workspace or MAT-file. Each signal comes in as a separate variable. Associated time vectors are also generated.
Calling 'mdfimport' without parameters brings up a interactive GUI. Calling 'mdfimport' with parameters reads the signals in directly.
Instructions: Unzip attached files and put on your path or in the current directory. Type mdfimport to run. Access help from the tools Help menu of the GUI for more information or by directly reading the two HTML files included.

Tested in releases from R13 to R2006A. Tested more with MDF files generated by ETAS INCA. Does work with some files VECTOR CANtech CANape.

Acknowledgements

This file inspired Mdf Import Tool And Function With Resampling/Interpolation and Xda > Signal List.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (43)
19 Feb 2014 anoosha pravallika

I have following error.... Can someone help me in fixing it....

Subscripted assignment dimension mismatch.

Error in mdfimport>mdfblockread (line 1918)
Block.(fieldname)(record,:)=fread(fid,count,['*' precision])';

Error in mdfimport>mdfinfo (line 1230)
TXBlockTemp2=mdfblockread(formatstxtext(TXBlockTemp.blockSize),fid,current,1);

Error in mdfimport>populate_GUI (line 401)
[MDFsummary, MDFInfo, counts, channelList]=mdfinfo(handles.fullFileName);

Error in mdfimport>Load_MDF_File_Callback (line 607)
handles=populate_GUI(handles); % Populate GUI (list box)

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in mdfimport (line 78)
gui_mainfcn(gui_State, varargin{:});

Error while evaluating uimenu Callback

18 Feb 2014 anoosha pravallika

how do I use this tool ? I am so new to Matlab... I have (.dat) files and I want them to make it compatible with Matlab for some program

13 Dec 2013 satish

Thank you

12 Jul 2013 Sebastian

Ok, I do it one by one after driving ;)
Didnt you find another script with google ? I also heard about a Toolbox doing this. But I dont know any details

12 Jul 2013 shilpa

Thanks Stuart :)

Hello Sebestian ,

But in CANape I couldnt convert more than 40 mdf files at a time ..
Can you pls tell how did you execute it

Thanks in advance :)

12 Jul 2013 Sebastian

Yes, I do it with CANape.

11 Jul 2013 Stuart McGarrity

I believe the INCA or CANape tools do this.

11 Jul 2013 shilpa

thanks Stuart,

is there any way to convert 2.14 v mdf files to mat files?
thanks in advance :)

11 Jul 2013 Stuart McGarrity

Unfortunately only v3.0 of the standard is supported (and not all of it)

11 Jul 2013 shilpa

This Tool is not working for mdf version of 2.14.. any help ?

Thanks :)

03 Oct 2012 AlainMil

is it possible to recover automatically the measurement file comments?
- date
- hour
- project
- subject
- user comment

these informations are available with ETAS-MDA or by opening the file in a text editor

03 Oct 2012 AlainMil

sometime it's necessary to adapt the subfunction "mygenvarname" in "mdfimport.m" for having valid variable names

by adding some lines like :

varName = strrep(varName,'à','a'); % Replace 'à' with 'a'

I use this method also to shorten long variable names :

example :
varName = strrep(varName,'ETCSignals_ES1000_ES1135_ES1232_ETK_','');

14 Jun 2012 Jaco Momberg

Very helpful but doesn't allow variable list (VAR) import option: mdfimport(fullFileName,'workspace',VAR,'ideal'). First time raster (time1) is incorrectly populated and error when looking for txt file if VAR>3. This error was noticed when used as a function in the command line.

20 Mar 2012 Nilesh Waishampayan  
20 Mar 2012 Nilesh Waishampayan

I am trying to import some INCA data into the workspace. The problem I am running into is the the length of the signal name is more than 64 characters. Is there a way to change this limit.

What alternate options do I have to get this data into MATLAB?

Thanks,
Nilesh

06 Dec 2011 Nikhil  
02 Aug 2011 AlainMil  
06 Apr 2011 Christian Schultes

Great Tool. But it doesn't take older files with MDF-Version 2.14 - any help what can I do?

11 Jun 2010 Adrian

Nice tool :)

27 Jul 2009 Andreas Patzer

Hi all,

my name is Andreas Patzer and I'm the business development manager of CANape (Vector Informatik GmbH).

Thanks for the development of the import possibility of MDF-files into Matlab.
Please keep in mind that there is not ‘THE’ MDF file. In the early 90’ the MDF format was developed by Vector and Bosch and meanwhile there are some different MDF versions that are supported by CANape. Since years every development step was done in corporation with ETAS, to make sure that their and our customers have the same format.

One of the comments was like “ … not any more dependent of INCA MDA ..”. From my opinion ;-)) the very best tool to analyze MDF files is CANape or the analyzing subset of CANape, called CANgraph.

If you want to handle the MDF content in the Matlab workspace, please use the export possibilities in CANape. File | Converter options | Matlab Export Converter …

Please do not hesitate to contact me Andreas.patzer@vector-informatik.de

Thanks
Andreas

17 Apr 2009 Ingmar Brandt

Hello!

I've got some problems with the tool. Some signals in my CANape generated mdf-files (MDF - Version 3.1) are importable, some others aren't. The error message is the following one:

??? Error using ==> mdfimport>datatypeformat at 1944
Unsupported number of bits for unsigned int

Error in ==> mdfimport>mdfread at 1683
datatype=datatypeformat(signalDataType,numberOfBits); %Get signal
data type (e.g. 'int8')

Error in ==> mdfimport>mdfload at 1097
[data
signalNames]=mdfread(MDFInfo,dataBlock,selectedChannels);
% Load specified signals

Error in ==> mdfimport>importdatawithoptions at 2250
mdfload(options.MDFInfo,dataBlock,channelIndices,options.blockDesignation,ws,options.additionalText);

Error in ==> mdfimport>importdata_Callback at 345
importdatawithoptions(options);

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> mdfimport at 78
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

Does anybody have an idea if this problem is fixable? And if, how?

Thx Ingmar

25 Sep 2008 J. Wang

excellent tool!

19 Jun 2008 Andreas .

Thanks a lot!

16 Jun 2008 Sven P.  
19 May 2008 Sunil Lengare

Thank you Great Material

13 May 2008 KC YANG

It works well with INCA data. Next interation must be import all files at the same time.

15 Mar 2008 firstname lastname

fantastic!

28 Feb 2008 Jedediah Frey

There is a problem with some Canape created files. The 'longSignalName' is generated from the comment field on line 1274:
CNBlockTemp.longSignalName=TXBlockTemp.comment;

And when the signal names are used, the program only checks to see if longSignalName is not empty (Line 1578), a better method would be to use 'isvarname' to determine if the longSignalName is a valid Matlab variable name. Currently we have a few channels where the longSignalNames come back as gibberish.

This is my suggested fix:
Line 1578 to 1582:
if isvarname(longSignalNames{signal}) % If no long name, use signal name
useNames(signal)=longSignalNames(signal); % Use Long name
else
useNames(signal)=signalNames(signal);
end

Line 1599 to 1603:
if length(signalNames{signal})>length(longSignalNames{signal})||~isvarname(longSignalNames{signal}) % If signal name longer use it
useNames(signal)=signalNames(signal);
else
useNames(signal)=longSignalNames(signal); % Use Long name
end

10 Feb 2008 jerome M

Doesn't work with my mdf from CANApe. And doesn't display well on Matlab for Linux

22 Jan 2008 Mark Zurawski

It works well on all of my older MDF's. However, some of the newer MDF's from the Vector CANcaseXL Log seem to have an issue.

Here is a detail of the error:

??? Reference to non-existent field 'CNBlock'.

Error in ==> mdfimport>mdfinfo at 1569
pos=zeros(length(CGBlockTemp.CNBlock),1);

Error in ==> mdfimport>populate_GUI at 456
[MDFsummary, MDFInfo, counts, channelList]=mdfinfo(handles.fullFileName);

Error in ==> mdfimport>Load_MDF_File_Callback at 664
handles=populate_GUI(handles); Populate GUI (list box)

Error in ==> gui_mainfcn at 75
feval(varargin{:});

Error in ==> mdfimport at 124
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> mdfimport('Load_MDF_File_Callback',gcbo,[],guidata(gcbo))
Reference to non-existent field 'CNBlock'.

??? Error while evaluating uimenu Callback

20 Nov 2007 Manohar Chenekala

Sir,
Im using mdfimport to convert mdf files(CANAPE) to mat and m file. Im succeeding for some files. for some files Im unable to get M-file. Can you tell me what the limitations and compatibilities with MDF files(version,size etc). my id is manoharc@cmcltd.com

With regards,
Manohar.ch

29 Oct 2007 john coppola

sweet

25 Jul 2007 jerome edwards  
31 Oct 2006 G D

Doesn't work with formula conversion type 9, hence could not use for data import

13 Sep 2006 Elmar Riesmeier

Very useful tool - saves time and works just fine as function or via GUI.

14 Aug 2006 Timo Schmidt

Great!
Good feeling to be not dependent on ETAS-MDA any more.

21 Jul 2006 Gene DiValentin

I've been using this tool for a couple of months and it's fast, easy, and intuative to use. Postprocessing INCA data has become much eaiser. Thank you.

10 Jul 2006 Liu Qiang

Great!
After a month of analysis of the binary file, I find this tool just before I begin to write a similar tool.
Am I lucky or unlucky? :-P

24 May 2006 Xiao Zhang

Very nice job. Save us a lot of time. Thank you.

08 Mar 2006 Sebastien LAURENT

Very good job

15 Feb 2006 Douglas Basberg

Works seamlessly. Intuitive interface.
Help file is clear, but could use some grammer and typo checking. A big well done. This package will save many people hours. Thank you.

23 Jan 2006 Andrew Herman

A great asset to our algorithm development and validation efforts!

17 Jan 2006 Brian Gebby

Very worthwhile tool!

Updates
17 Jan 2006

Add missing "Create signal selection file" menu item. Change version number from .2 to 1.0

20 Jan 2006

* Ensure that long signal names are used for variables. Previously, signal names longer than 32 characters were truncated

* Changed "Remove device names" check box text to "Hide device names"

13 Mar 2006

* Now callable as a command.
* Generate the equivalent command and parameters
* Save imported signals to a MAT-File.
* Append variable names with rate strings
* Append variable names with additional text

20 Mar 2006

Removed version number

24 Mar 2006

Modified Summary

28 Mar 2006

* Added support for string data types
* Added support from formula conversion types 10 and 12

20 Jul 2009

Added trademarks.

04 Aug 2009

Copyright work.

04 Aug 2009
24 Feb 2014

Added copyright

Contact us