MATLAB Coder problem with discrete wavelet thresholding

Hello everyone. I wanted to generate a C code for my ECG noise removal program with dwt, but I ran into a problem. The Coder doesn't seem to like the wdencmp function. The script is tested, and it is working as intended, I only use the Wavelet toolbox which came with MATLAB, and I checked, all of the functions used are supported for C/C++ generation, and I have enabled the variable-sizing option.
The script is as follows:
function out = denoise(input)
%the thresholding values
thr = [...
0.013347585482866 ; ...
0.015872023591907 ; ...
0.144506458583803 ; ...
0.374411347716711 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ...
];
c = zeros(4170,1);
l = zeros(14,1);
% the deconstruction
[c,l] = wavedec(input,12,'sym4');
% thresholding algorithm
% 1. remove the average value
c(1:l(1)) = zeros(1,l(1));
% apply Heuristic SURE to the detail value
out = wdencmp('lvd',c,l,'sym4',12,thr,'s');
end
What am I overlooking? Any help would be appreciated.
Thanks in advance, Fehér Áron.

1 commentaire

Someone? Anything would be helpful for me to somehow break out of this error.

Connectez-vous pour commenter.

 Réponse acceptée

I have finally solved the problem. I've replaced wdencmp with wthcoef and the compiler liked it. Still I have no clue why I got the error, since wdencmp uses wthcoef. Oh well... I am posting the working function if someone needs it.
function out = denoise(input)
%the thresholding values
thr = [...
0.013347585482866 ; ...
0.015872023591907 ; ...
0.144506458583803 ; ...
0.374411347716711 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ; ...
0.000000000000000 ...
];
c = zeros(4170,1);
l = zeros(14,1);
% the deconstruction
[c,l] = wavedec(input,12,'sym4');
% thresholding algorithm
% 1. remove the average value
c(1:l(1)) = zeros(1,l(1));
% apply Heuristic SURE to the detail value
cxc = wthcoef('t',c,l,1:12,thr,'s');
% the reconstruction
lxc = l;
out = waverec(cxc,lxc,'sym4');
end

Plus de réponses (0)

Catégories

En savoir plus sur AI for Signals and Images dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by