problem while converting .m file to .vhd using hdl coder matlab 2012a
조회 수: 13 (최근 30일)
이전 댓글 표시
function [XC] = dwt_aut12(x)%#codegen
assert(isreal(x));
coder.extrinsic('–sync:on','wavedec');
coder.extrinsic('–sync:on','wrcoef');
coder.extrinsic('–sync:on','conv2');
coder.extrinsic('–sync:on','ddencmp');
coder.extrinsic('–sync:on','wdencmp');
coder.extrinsic('–sync:on','subplot');
coder.extrinsic('–sync:on','plot');
[c,l] = wavedec(x,5,'sym10');
z=wrcoef('a',c,l,'sym10',5);
[THR,~,KEEPAPP]=ddencmp('den','wv',z);
[XC,~,~,~,PERFL2] = wdencmp('gbl',z,'sym4',4,THR,'h',KEEPAPP);
subplot(3,1,1);
plot(z);
subplot(3,1,2);
plot(XC);
% subplot(3,1,3)
%hold on;plot(z(1:400),'b');plot(XC(1:400),'r'); hold off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
calling the above function through the code below
load s.mat;
dwt_aut12(s(1:400,2));
%%%%%%%%%%%%%%
_While converting the coder shows the following error : _ Expecting MATLAB design "dwt_aut12" to be a function and not a script Use help codegen for more information on using this command. even though its a function.
댓글 수: 0
답변 (2개)
Tim McBrayer
2012년 11월 14일
I ran a slightly modified version of your code in R2012b and it does not generate this error. The main change I made was changing the primary input to a single dimension, as a 2-D array is not supported on the input. The original matrix can be reshape() back into the desired format. I also made the testbench file a function as well.
There are further issues to be encountered, but if you make these two changes you should get past this sticking point.
Walter Roberson
2013년 1월 9일
Convert the file that has the load() and dwt_aut12 call, into a function.
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!