Brace indexing is not supported for variables of this type.
2 views (last 30 days)
Show older comments
reference_data=readtable('reference_150ohmn.csv');
2 Comments
Stephen23
on 23 Apr 2021
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?
Accepted Answer
Star Strider
on 23 Apr 2021
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 Comments
Star Strider
on 25 Apr 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
More Answers (0)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!