Brace indexing is not supported for variables of this type.

2 views (last 30 days)
reference_data=readtable('reference_150ohmn.csv');
  2 Comments
Stephen23
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?
Joy
Joy on 23 Apr 2021
That wasn't supposed to be there, I had forgot to delete it because it didn't work

Sign in to comment.

Accepted Answer

Star Strider
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')
ViewContents = 10017×2 cell array
{'Model' } {'MDO3024' } {'Firmware Version' } {[ 1.1400]} {'Waveform Type' } {'ANALOG' } {'Point Format' } {'Y' } {'Horizontal Units' } {'s' } {'Horizontal Scale' } {[ 1]} {'Horizontal Delay' } {[ 0]} {'Sample Interval' } {[ 1.0000e-03]} {'Record Length' } {[ 10000]} {'Gating' } {'0.0% to 100.0%'} {'Probe Attenuation'} {[ 1]} {'Vertical Units' } {'V' } {'Vertical Offset' } {[ 0]} {'Vertical Scale' } {[ 0.0500]} {'Vertical Position'} {[ 5]} {'Label' } {1×1 missing }
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))
Ts = 1.0000e-03
Fs = 1/Ts
Fs = 1.0000e+03
% % % % % % % % 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
Star Strider on 25 Apr 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!