problem while converting .m file to .vhd using hdl coder matlab 2012a
Show older comments
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.
Answers (2)
Tim McBrayer
on 14 Nov 2012
0 votes
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.
1 Comment
santosh siva
on 9 Jan 2013
Walter Roberson
on 9 Jan 2013
0 votes
Convert the file that has the load() and dwt_aut12 call, into a function.
Categories
Find more on Code Generation 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!