Brace indexing is not supported for variables of this type.
1 次查看(过去 30 天)
显示 更早的评论
reference_data=readtable('reference_150ohmn.csv');
2 个评论
Stephen23
2021-4-23
i is defined in this code as a scalar numeric loop iterator:
for i=1:1:size(reference_time,1)
..
if isnumeric(i{1}) || ischar(i{1}) || islogical(i{1}) || isstruct(i{1})
.. % ^^^ ^^^ ^^^ ^^^
end
end
What do you expect curly brace indexing into a scalar numeric to achieve?
采纳的回答
Star Strider
2021-4-23
The problem is immediately apparent on viewing the contents —
ViewContents = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/594720/reference_150ohmn.csv')
Try this instead: —
reference_data=readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/594720/reference_150ohmn.csv', 'HeaderLines',16);
reference_data.Properties.VariableNames = {'TIME','REF1'};
reference_time=reference_data.TIME;
reference_voltage=reference_data.REF1;
Ts = mean(diff(reference_time))
Fs = 1/Ts
% % % % % % % % THE COMMENTED-OUT SECTION IS NOT NECESSARY, SO DELETE IT —
% x = zeros(1, 10000);
% for i=1:size(reference_time,1)
% reference_time_double=str2double(cell2mat(reference_time(i)))
% end
% reference_time_double=reference_time_double+5;
% x1 = zeros(1, 10000);
% for i=1:1:size(reference_time,1)
% for reference_voltage_double=str2double(cell2mat(reference_voltage(i)))
% end
% if isnumeric(i{1}) || ischar(i{1}) || islogical(i{1}) || isstruct(i{1})
% x1(i)=1:1:size(reference_time,1);
% end
% end
filterred_reference=bandpass(reference_voltage,[0.51,59],Fs); % bandpass filtering
notch_frequencies=[58 61];
Sig_notch_reference=bandstop(filterred_reference,notch_frequencies,Fs); % notch filtering
f1=figure('units','normalized','outerposition',[0 0 1 1]);
subplot(2,1,1)
plot(reference_time,reference_voltage,'k','LineWidth',1)
grid on
title('Reference Electrode, before filtering')
set(gca,'FontSize',20);
subplot(2,1,2)
plot(reference_time,Sig_notch_reference,'k','LineWidth',1)
title('Reference Electrode, after filtering')
grid on
set(gca,'FontSize',20);
The filtering obviously needs work. Since I have no idea what you want to do, I will leave that to you.
I would apply the 60 Hz notch (bandstop) filter first, then use a bandpass filter with a bandwidth of 1 Hz to 100 Hz to filter the EKG. That willl remove the baseline wander and any remaining high-frequency noise without removing necessary parts of the EKG trace itself.
.
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!