Get Variable from mdfObJ based on ChannelGroupNumber

4 Ansichten (letzte 30 Tage)
Dennis
Dennis am 28 Sep. 2022
Beantwortet: Tushar am 7 Dez. 2023
I know that there is this example of a command in the vehicle network toolbox documentation.
[data,time] = read(mdfObj,chanGroupIndex,chanName,startPosition,endPosition,"OutputFormat", "vector")
[data, time] = read(m, 1, "Triangle", 1, 10, "OutputFormat", "vector")
For my case this does not work, because the extraction of the data needs to be automated and the entire channel should be extracted.
For instance in a mdf-object there is the variable d2s. Its Channelgroupnumber is for instance 2.
Then I can easily access it. so far so good..
But in my case mf4-files with different sizes are loaded into matlab with the mdf-command.
So far i was not able to figur out how to search thru the data for the channelgroupnumber of a specified channelname that i want to output as a vector.
I know that with the channelList(m) (m=mdf('xxx.mf4')) command I get a table with information about Channelgroupnumber, channelname,...
But I don't get to the point to implement it into the read-command.
Hope you guys can help!

Antworten (1)

Tushar
Tushar am 7 Dez. 2023
Hi Dennis,
It is my understanding that you want to read the data from an MDF-file for a specific channel. Currently, you are using the ‘read’ function for this purpose. It is important to note that the ‘read’ function is no longer recommended and might be removed in a future release, as mentioned in the documentation you referred to, the link to which is mentioned below.
It is recommended to use the ‘mdfRead’ function to directly access the MDF-file. To read all data from the MDF-file for specified channel names, you may use the below command.
data = mdfRead("VehicleData.mf4", Channel= ["*Torque" "*Rate"]);
% Here, we are reading the data for the ‘Torque’ and ‘Rate’ channels
For more information on the ‘mdfRead’ function, see the below documentation.
To transition your ‘mdf’ object code, you can find additional information in the below documentation.
I hope this helps resolve the issue you are facing.
Regards,
Tushar

Community Treasure Hunt

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

Start Hunting!

Translated by