0

I am currently working with MDF file(.mf4) in MATLAB and I don't want to see the ChannelNumsamples that contain no values or lets say zero values so how to do that? I have tried with this code. but it is not helping me to extract nonzeroes elements.

cc = table2array(dd(1,:))
if table2array(A(x,"ChannelGroupNumSamples")) >= 0
    disp('YES');
    A(x,3)
    size(cc);
else disp('nodata')


numel(cc)
Elements = sum(cc ~= 0)
elementscount = nonzeros(Elements)
end
Adriaan
  • 17,741
  • 7
  • 42
  • 75
gbk0029
  • 1
  • 1

1 Answers1

0

To open an MDF file and read the data from it, but remove channel groups that don't contain any samples, you can do something like

m = mdf('myMDFfile.mf4');
mData = m.read;
for group = 1:numel(m.ChannelGroup)
    if m.ChannelGroup(group).NumSamples == 0
        mData(group) = [];
    end
end

Now mData is a cell array of timetables containing only the data from the channel groups that had one or more samples.

nekomatic
  • 5,988
  • 1
  • 20
  • 27
  • Thank you so basically I got MDF file and I have to extract that data that has some values for e.g some variables dont have any values to show and that I dont want to display and further is I want to display this data in matlab app designer and make GUI so that user can select any variable they want to see and by clicking the graph opens up. – gbk0029 Feb 11 '22 at 06:57