How do I save value of variable in matrix form, which is overwritten after each iteration in for loop?
古いコメントを表示
Here is the code that I have written, in this I want all the values of T in each iteration but it overwritten after each iteration and I am getting only last value of T.
load ('100m.mat') % the signal will be loaded to "val" matrix val = (val - 1024)/200; % you have to remove "base" and "gain" ECGsignal = val(1,1:3600); % select the lead (Lead I) Fs = 360; % sampling frequecy t = (0:length(ECGsignal)-1)/Fs; % time subplot(2,1,1) plot(t,ECGsignal) sig = smoothts(ECGsignal, 'b', 5); subplot(2,1,2) plot(t,sig)
%% Beat Rate Calculation beat_count=0; for k = 2 : length(sig)-1 if(sig(k)>sig(k-1) & sig(k)>sig(k+1) & sig(k)>0.5) k disp('Prominant Peak found') beat_count = beat_count+1; R = sig(k); % Value of R peak
T = (k/Fs) % Time at which R peak is occuring
disp('Time at which R peak is occuring(sec)')
end
end
N = length(sig);
Duration_in_seconds = N/Fs;
Duration_in_minutes = Duration_in_seconds/60;
BR = beat_count/Duration_in_minutes
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Transmitters and Receivers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!