Code covered by the BSD License  

Highlights from
MDF Import Tool and Function

4.52

4.5 | 25 ratings Rate this file 127 Downloads (last 30 days) File Size: 38.77 KB File ID: #9622
image thumbnail

MDF Import Tool and Function

by Stuart McGarrity

 

13 Jan 2006 (Updated 04 Aug 2009)

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 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 submission has inspired the following:
MDF Import Tool and Function - with resampling/interpolation, XDA -> signal list
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (28)
17 Jan 2006 Brian Gebby

Very worthwhile tool!

23 Jan 2006 Andrew Herman

A great asset to our algorithm development and validation efforts!

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.

08 Mar 2006 Sebastien LAURENT

Very good job

24 May 2006 Xiao Zhang

Very nice job. Save us a lot of time. 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

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.

14 Aug 2006 Timo Schmidt

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

13 Sep 2006 Elmar Riesmeier

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

31 Oct 2006 G D

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

25 Jul 2007 jerome edwards  
29 Oct 2007 john coppola

sweet

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

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

10 Feb 2008 jerome M

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

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

15 Mar 2008 firstname lastname

fantastic!

13 May 2008 KC YANG

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

19 May 2008 Sunil Lengare

Thank you Great Material

16 Jun 2008 Sven P.  
19 Jun 2008 Andreas .

Thanks a lot!

25 Sep 2008 J. Wang

excellent tool!

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

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

11 Jun 2010 Adrian

Nice tool :)

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?

02 Aug 2011 AlainMil  
06 Dec 2011 Nikhil  
Please login to add a comment or rating.
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

13 Sep 2007

Changed screenshot

20 Jul 2009

Added trademarks.

04 Aug 2009

Copyright work.

Tag Activity for this File
Tag Applied By Date/Time
data import Stuart McGarrity 22 Oct 2008 08:12:28
data export Stuart McGarrity 22 Oct 2008 08:12:28
mdf etas import gui tool calibration matlab measured data bosch Stuart McGarrity 22 Oct 2008 08:12:28
mdf etas import gui tool calibration matlab measured data bosch Thomas Becker 10 May 2010 05:07:24
data import Jianqiang Chen 30 Jan 2012 07:03:35

Contact us at files@mathworks.com