Why do I obtain identical graphs while for loop is accessing different sets of data stored in different column?

1 Ansicht (letzte 30 Tage)
Hi all,
I have an array CHANNEL [10 58 27] and neural.spikes contain three columns each with different sets of data. Using the second for loop, I'm trying to plot the three sets of data separately, which should look different. But I'm obtaining three identical graphs while idx iterates from 1 to 3, which should allow me to plot the three columns of data stored in neural.spikes. Can anyone please tell me what is wrong with my code?
Thank you in advance for your help!
for di=CHANNEL(1,:)
%load (append('210603_bare-210727-182826','ch',string(di)))
neural = timetable(RawData,'SampleRate',fs);
neural.Properties.VariableNames{1} = 'raw';
neural.Properties.VariableUnits{1} = 'Volts';
HighPass = 300;
LowPass = 5000;
[Z, P, K] = butter(5, [HighPass LowPass]/(fs/2), "bandpass");
sos = zp2sos(Z, P, K);
neural.raw = double(neural.raw);
neural.spikes = sosfilt(sos,RawData);
for idx=1:length(CHANNEL)
figure;
nexttile;
plot(neural.Time,neural.spikes(:,idx))
end
xlim([duration(0,init_mn,init_s,init_ms) duration(0,end_mn,end_s,end_ms)])
ylim([-1e-4 1e-4])
end

Antworten (1)

M.B
M.B am 6 Aug. 2021
Check the following:
- length(CHANNEL) is not equal to 1
- data in neural.spikes(:,1) are different from neural.spikes(:,2)?
Set a break point before "for idx=1:length(CHANNEL)" and run this code:
figure(123);
plot(neural.Time,neural.spikes(:,1)); hold on;
plot(neural.Time,neural.spikes(:,2));
plot(neural.Time,neural.spikes(:,3));
  1 Kommentar
Peter Perkins
Peter Perkins am 6 Aug. 2021
Yes, my guess is that neural.spikes = sosfilt(sos,RawData) isn't doing what you think it is. Set a break point at that line and check in the inputs and outputs.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by