Error related to "wden" in wavelet toolbox

4 views (last 30 days)
I try to denoise a signal with "wden" functon.
I followed the instruction and example provided by Mathwork, which is listed below:
snr = 3; init = 2055615866;
[xref,x] = wnoise(3,11,snr,init);
lev = 5;
xd = wden(x,'heursure','s','one',lev,'sym8');
Then the error message is shown:
Undefined function 'compare_strut_fieldnames' for input arguments of type 'struct'.
Error in iswtf (line 90)
tf = compare_strut_fieldnames(wtf_s, wtf);
Error in dwt (line 119)
elseif (iswtf(wtf))
Error in wavedec (line 45)
[x,d] = dwt(x,Lo_D,Hi_D); % decomposition
Error in wden (line 72)
[c,l] = wavedec(x,n,w);
It seems like Matlab cannot find the function "compare_strut_fieldnames". I suspect there is a typo that it should be "struct", not "strut". So I just copy the function "compare_struct_fieldnames" and renamed it to "compare_strut_fieldnames". But still doesn't work.
I tried other denoise function such as wdencmp, and still invalid due to the same error.
By the way, My Matlab version is R2014a.
Please Help. Thank you :)

Accepted Answer

Wayne King
Wayne King on 23 Jan 2015
Hi Steven,
This code runs correctly on R2014a.
snr = 3; init = 2055615866;
[xref,x] = wnoise(3,11,snr,init);
lev = 5;
xd = wden(x,'heursure','s','one',lev,'sym8');
I believe your issue is that you have some non-MathWorks' functions on your path preceding MathWorks functions. Because they are named the same as the MathWorks function, that is causing the issue.
For starters, please enter
>>which dwt
at the command prompt.
You should get something back like:
matlab\toolbox\wavelet\wavelet\dwt.m
If you have downloaded somebody else's version of dwt.m then that can explain the errors you are seeing.
The errors you are reporting in "compare_strut_fieldnames" or even "compare_struct_fieldnames" as well as iswtf() are not functions that exist or would be called by the code example you show. In other words, not part of the MathWorks' Wavelet Toolbox.
If you find that you are calling a dwt.m that is not in matlab/toolbox/wavelet/wavelet then please remove the folder with the non-MathWorks' dwt.m from your path, or move that function somewhere outside of the MATLAB path.
Hope that helps,
Wayne
  1 Comment
steven7337
steven7337 on 23 Jan 2015
Yes, you are right! After I fixed the path, it worked! Thank you very much :)

Sign in to comment.

More Answers (0)

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!