How do I re-save a MDF file in a specified location?

3 views (last 30 days)
I am loading multiple MDF files and then removing a few rows in each file.
I wish to save the changes I made to this data back as an MDF format itself.
I have attached the code I am using.
As can be seen above, I am changing the data in one particular group per file. And my requirement is to save the updated file now back as MDF format.
Hope my query is made clear. :)

Answers (1)

Harimurali
Harimurali on 11 Feb 2024
Edited: Harimurali on 11 Feb 2024
Hi Aikansh,
The "mdfRead" and "mdfWrite" functions provided by MATLAB can be used to read and save the updated file back in MDF format. Here is an example MATLAB script that shows how to read an MDF file, change the data in a channel group of the MDF file, and write the changes back to the MDF file:
% read the channel group "idx" data
chanGrpData = mdfRead("/path/to/mdfFile.mf4", GroupNumber=idx, IncludeMetadata=true);
chanGrpTT = chanGrpData{1};
% make the required changes (like deleting rows from the timetable)
% make the mdf file writable
fileattrib("/path/to/mdfFile.mf4", "+w");
% write the updated data to the channel group "idx" of the mdf file
mdfWrite("/path/to/mdfFile.mf4", chanGrpTT, GroupNumber=idx);
Refer the documentation of the "mdfWrite" function for more information about the function and its limitations : https://www.mathworks.com/help/releases/R2023b/vnt/ug/mdfwrite.html
Refer the following documentation for more information about overwriting an MDF file in MATLAB: https://www.mathworks.com/help/releases/R2023b/vnt/ug/overwrite-channel-group-data-in-an-mdf-file.html

Categories

Find more on Cardiology in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!