Effacer les filtres
Effacer les filtres

How to work with mdlDatastore and multiple channelgroups?

5 vues (au cours des 30 derniers jours)
Ben_A.
Ben_A. le 11 Jan 2022
Hello dear Matlab-Community,
i have the following problem and maybe one of you has already a good solution:
given:
a bunch of several CANape-meassurementfiles (*.mdf-files) ~10GB of data, aprox. 800 Channelgroups and lots of signals..
target:
create a new , reduced dataset with only specific signals and the corresponding values and data within for detailed analysis
problem:
the Property "DS.SelectedChannelgroupNumber" accepts only a single scalar number.
but the needed signals are fragmented over several (e.g. 8) channelgroups!
i don't like the solution to loop 8 times (for the ammount of channelgroups) through all the given *.mdf4-files (~100 with each 300MB in size) to extract / read the needed data.
it should be better in way of access-timing for network stored data to open a single file at once, read all the needed channelgroups and then step to the next file instead of reopening all the files after reading each selected channelgroup...
My current beginning of a solution:
% define list of signals of interesst:
signals={'signal1';'signal2';'signal3','signal4';'signal_n'};
% creation of mdfDatastore from one example-folder
Filepath='c:\MDF_Files\'; %folder includes files of type *.mf4
DS=mdfDatastore(Filepath);
% get reduced Dataset by given channelname and corresponding channelGroupNumber:
Temp=DS.Channels(:,{'ChannelName','ChannelGroupNumber'});
Temp=Temp(ismember(Temp.ChannelName,signals),:)
% find unique ChannelGroupNumbers of wanted signals:
Groups=unique(Temp.ChannelGroupNumber)
% returns a list e.g. Groups=[3;123;666]
% and then a for-loop through all the Data for each the individual
% ChannelGroupNumbers
I hope there is a more elegant way to read the needed Data ;-)
Cheers and thanks for your interest, Ben

Réponses (1)

Ayush Modi
Ayush Modi le 10 Jan 2024
Hi Ben,
As per my understanding, you are trying to create a new, reduced dataset with only specific signals and the corresponding values and data within each file. You can achieve this using the “mdfRead” function. Here is an example to demonstrate how you can read all available data from the MDF-file for specified channel names:
data = mdfRead("VehicleData.mf4",Channel=["*Torque" "*Rate"]);
Please refer to the following MathWorks documentation for more information on the “mdfRead” function:
You can iterate over each file using "for" loop and get the required data using "mdfRead" function efficiently.
I hope this resolves the issue you were facing.

Catégories

En savoir plus sur Digital and Analog Filters dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by