Error related to "wden" in wavelet toolbox

조회 수: 5 (최근 30일)
steven7337
steven7337 2015년 1월 22일
댓글: steven7337 2015년 1월 23일
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 :)

채택된 답변

Wayne King
Wayne King 2015년 1월 23일
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
steven7337
steven7337 2015년 1월 23일
Yes, you are right! After I fixed the path, it worked! Thank you very much :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by