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 个评论

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

请先登录,再进行评论。

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by