function PDQ2cwtscg_cnn(ecgdata, cwtfb, ecgtype)
nos = 25; %number of signals
no1 = 450; %signal length
colormap = jet(128);
if strcmpi(ecgtype,'Sag') ==1
s1 = 'Yes';
s2 = 'yes';
folderpath = strcat('/MATLAB Drive/CNN/Sag');
findx = 0;
for i = 1:50
indx = 0;
for k = 1:nos
ecgsignal = ecgdata(i, indx+1: indx+no1);
cfs = abs(cwtfb.wt(ecgsignal));
im = ind2rgb(im2uint8(rescale(cfs)), colormap);
filenameindex = findx + k;
filename = strcat(folderpath, sprintf('%d.jpg', filenameindex));
imwrite(imresize(im, [240 240]), filename);
indx = indx + no1;
end
findx = findx + nos;
end
elseif strcmpi(ecgtype,'Swell') == 1
folderpath = strcat('/MATLAB Drive/CNN/Swell');
findx = 0;
for i = 1:50
indx = 0;
for k = 1:nos
ecgsignal = ecgdata(i, indx+1: indx+no1);
cfs = abs(cwtfb.wt(ecgsignal));
im = ind2rgb(im2uint8(rescale(cfs)), colormap);
filenameindex = findx + k;
filename = strcat(folderpath, sprintf('%d.jpg', filenameindex));
imwrite(imresize(im, [240 240]), filename);
indx = indx + no1;
end
findx = findx + nos;
end
else
folderpath = strcat('/MATLAB Drive/CNN/Harmonics');
findx = 0;
for i = 1:50
indx = 0;
for k = 1:nos
ecgsignal = ecgdata(i, indx+1: indx+no1);
cfs = abs(cwtfb.wt(ecgsignal));
im = ind2rgb(im2uint8(rescale(cfs)), colormap);
filenameindex = findx + k;
filename = strcat(folderpath, sprintf('%d.jpg', filenameindex));
imwrite(imresize(im, [240 240]), filename);
indx = indx + no1;
end
findx = findx + nos;
end
end
end