combining 2 ECG signal into 1

1 次查看(过去 30 天)
I'm tring to merg 2 ECG signal into one (with same sampling rate), however, at the merging point, there is some error. I can't figure it out. could someone please help, appreciated. my code and the figure are attached.
clear all
close all
dataaf=load("AF2.mat"); % AF signal
xaf=dataaf.val(1,:);
xaf=detrend(xaf)';
datan=load("normal2.mat"); % Normal
xn=datan.val(1,:);
xn=detrend(xn)';
%xnr=resample(xn,250,128); % resample raw signal
xc=[xn;xaf];
Fs = 128;
t = (0:length(xc)-1)/Fs; %time value of any sample = [sample no./Fs]
plot(t,xc)
xlabel('Time [s]')
% hold on
pause

采纳的回答

Star Strider
Star Strider 2022-5-26
Unless the row vectors ‘xn’ and ‘xaf’ have the same number of elements, the vertical concatenation to produce ‘xc’ is going to fail:
xc=[xn;xaf];
Horizontrally concatenating them (note the substitution of the comma for the semicolon) however will work:
xc=[xn,xaf];
.
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by