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

7 vues (au cours des 30 derniers jours)
Aikansh Sharma
Aikansh Sharma le 8 Juil 2021
Modifié(e) : Harimurali le 11 Fév 2024
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. :)

Réponses (1)

Harimurali
Harimurali le 11 Fév 2024
Modifié(e) : Harimurali le 11 Fév 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

Catégories

En savoir plus sur Vehicle Calibration dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by