How do I re-save a MDF file in a specified location?
4 次查看(过去 30 天)
显示 更早的评论
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. :)
0 个评论
回答(1 个)
Harimurali
2024-2-11
编辑:Harimurali
2024-2-11
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!