MATLAB Coder error with resample function
Show older comments
MATLAB Coder function call failed when using non-unity ratios of p and q. The documentation says that when using the resample function, the p and q variables have to be positive, integer values and are used to form a ratio for the time resampling process. However, any time that we use a ratio of p/q that is not equal to 1, the MATLAB coder fails to call the functions and gives us an error. The first code and image showcase what we are talking about which successfully gets converted while the second does not. Is there something that we overlooked or were not aware of in the conversion process or function call?
More code and info available if needed.

function y = pitch_func0(a)
p = 1;
q = 1;
r = p/q;
n = 1024;
x = pvoc(a, r, n);
y = resample(x,p,q);
end

function y = pitch_func2(a)
p = 19;
q = 20;
r = p/q;
n = 1024;
x = pvoc(a, r, n);
y = resample(x,p,q);
end
4 Comments
Walter Roberson
on 8 Jun 2018
pvoc appears to be https://www.mathworks.com/matlabcentral/fileexchange/45441-phase-vocoder?focused=3880845&tab=function
I notice that you are not pre-allocating x or y and you are not using coder.varsize(). I would expect size problems in such a case.
Justin Bugayong
on 8 Jun 2018
Walter Roberson
on 8 Jun 2018
Sorry, I seem to be getting backlogged. I do not think I am going to be able to investigate this one myself.
Denis Gurchenkov
on 25 Jul 2018
Justin, are you all set with this? If you still have an issue, please attach your .m files and the .prj file and someone from MATLAB Coder team will take a look.
Answers (0)
Categories
Find more on MATLAB Coder 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!
