Clear Filters
Clear Filters

CNN classification from array

3 views (last 30 days)
Theodora Chivu
Theodora Chivu on 9 Dec 2020
Hi I want to classify an ECG signal with 9 million samples using cnn and the adnotation array. I divided the signal into multiple ones into an array and now i have an array of 30 000 signals x 300 samples. I want to do cwt (continuous wavelet transform) for every line in the array and then classify them using cnn toolbox. Is there a way to do this using a for loop and extract the image in two different folders knowing the value of the first row (the adnotation)? For example if for line 5 the first row have 1 extract the figure from cwt in AF folder, if not extract it in N folder and then train my cnn?
main:
[signal,Fs,tm]=rdsamp('08455');
[ann]=rdann('08434','atr');
sig = signal(:,1); %number of samples
samp=length(tm);
increm = 1/Fs; %incrementation of samples
nr_c = tm(samp,1)/1.2; %number of samples extracted
l_adn=length(ann);
sig2 = filtrare(sig);
total = segmentare (nr_c,increm,sig2,l_adn,ann,Fs);
segmentare:
function y = segmentare(a,c,s,d,adn,f)
y = zeros();
samp =9205760;
for i=1:a-1 %lines in matrix
poz=(1.2/c); % number of signals segmentated
for j=1:poz % columns
if i==1
poz1=1; %adnotation signal
else poz1=poz*(i-1);
end
for l=1:d
if adn(l,1)>=poz1 && adn(l,1)<=(poz*i)
y(i,1)=1;
end
end
y(i,j+1) = s((poz*(i-1)+j),:); %final matrix
end
end
wavelet_continuu(y,a,f); %wavelet transform for every signal
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!