[英]Select nonzero elements from MDF files in MATLAB
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?我目前正在使用 MATLAB 中的 MDF 文件 (.mf4),我不想看到不包含值的 ChannelNumsamples 或让我们说零值,那么该怎么做呢? 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
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要打开 MDF 文件并从中读取数据,但删除不包含任何样本的通道组,您可以执行类似
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.现在mData
是一个时间表元胞数组,仅包含来自具有一个或多个样本的通道组的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.