File Exchange

image thumbnail


version (15.3 KB) by Rahul Rajampeta
Converts MAT to DAT format (MDF 3.0) which can be read by ETAS MDA or CANape tool.


Updated 19 Aug 2017

GitHub view license on GitHub

Converts Matlab/Simulink data stored in 'MAT' format to DAT format (MDF 3.0) which can be read by ETAS MDA or CANape tool.
Please follow instruction to use at GitHub repo:

Cite As

Rahul Rajampeta (2020). ExportMDF (, GitHub. Retrieved .

Comments and Ratings (20)

Raul Gomez

It works great!
Thank you very much for the function

I would like to ask you if there's a way to export a MDF document with multiple tables (insted of only one) in the same file.
I have different signals with different time vectors for data reduction and I would like to have all them in one MDF file.

Andrew Tilmouth

Have used this many times now to convert data from Excel/Matlab into MDA for plotting, massive time saving, Excellent


Error comes up: Undefined function 'writeDatFile' for input arguments of type 'struct'. how to resolve?

David Kröter

@Rahul: Somehow, I never got a message that you commented on me. I have created an issue. It would be very nice if you could look at it!

Rahul Rajampeta

@David Kröter - could you create an issue in the github repo ( and attach mat-file to the issue. Thanks!

David Kröter

Hey Rahul!
Great submission! However, I have a problem exporting vector signals: Once a signal with higher dimension (i.e. 1x16) is included in the logsout structure, the data cannot be read anymore using my preferred signal analysis tool. If you want, I can provide you the *.mat of my logsout structure, so you can do some further investigations.
Best regards,

Jianbin Liu

Rahul Rajampeta

@Andrew check GitHub repo for m scripts

Rahul Rajampeta

@Arunkumar Not currently. But, you could pre-process signals to fixed time vector with the fastest time raster (eg interp1 with a fixed time vector )..

Hi Rahul,
Can this tool also handle MAT files containing data with different raster?


Andrew Tilmouth

Is there any possibility to post this as a .m script for people with older versions of matlab e.g. 2012a that can't use apps, it would be hugely appreciated

Bulent Unver


First of all thank you for your study.

Is there a solution for exporting datesets which have signals with different lenght?

Another question;
Is there a solution for exporting datesets which have BUS signals?

Thanks for your help.

Sibi Krishnan K

ExportMDF app is working good.
I would like to know if a MATLAB function for data export available with you to use in scripts? Could you share it if possible?
Thank you.


Hi it is Really good tool for engineer who works using CANape Or INCA tool

Tool works great.nice. Thank you.

But is there any way to make in work at MATLAB 2013a ( Or Any Older Version than 2013b)??

I know that the struct2table Function is available at 2013b version. and I think this function is very important for this

Can you help me about this problem? Thank you very much

First of all thank you for your time.
Yours script works well but only with 1 signal inside the mat file. If you have many signals it will not work anymore.

All the signals are merged into 1 signal with this ligne.
"dataStruct = classStruct(rawStructure)"

Thanks for your help.

Rahul Rajampeta

@Konrad Bertignoll:

Thanks for the feedback. I did update the script to fill 0x0 for 28 bytes. It should work the CANape tool as well.


Konrad Bertignoll

@Rahul Rajampeta:

Tool works great!

I checked the mdf standard:
the 28 Bytes you filled with 0x20 are reserved bytes.
CANape only works if the are zero.
If you could change them to zero ETAS MDA tool & CANape should work without problems :-)

Rahul Rajampeta

@Konrad Bertignoll: Thanks for the feedback.
The output file of the app is intended to be used with ETAS MDA tool. The format required for that specifies the first 64bytes to be in a particular format.
Glad it works for CANape with a patch.

Konrad Bertignoll

I was unable to open the mdf3 file with CANape. After checking it with the vector mdf checker
I found the problem:
Bytes 0x20 to 0x3C (28 Bytes) should be filled with 0x0 instead of 0x20.

After patching it works!



Updated minimum requirement for Matlab version. Moved the files to GitHub repository:

use INLINE with your model simulation as a post script when simulation data is saved as SimulationDataset
eg: mat2dat(logsout, 'test_data.dat'). logsout --> SimulationDataset object, 'test_data.dat' --> output filename

Includes the update for using the output file with CANape.

bug fixes


Supports non-uniform Time series, generated through variables logged in enable/trigger/function call subsystems. No data values are interpolated to nearest available values.


Update now reads workspace variables selected to create a MAT file. (use TimeSeries as the parameter option for the 'to workspace' blocks)

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

Inspired by: MDF Import Tool and Function