MATLAB Coder error with resample function

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 comentarios

Walter Roberson
Walter Roberson el 8 de Jun. de 2018
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.
Hi Walter,
Thank you for responding!
We did notice that size of each output vector differed when we adjusted p and q. We tried implementing coder.varsize() and we got the same results. Here is our code:
function y = pitch_func1(a)
p = 21;
q = 20;
r = p/q;
n = 1024;
[rows,columns] = size(a)
coder.varsize('x','y',44100);
x = zeros(rows,columns);
y = zeros(rows,columns);
x = pvoc(a, r, n);
y = resample(x,p,q);
end
We tried playing around with different ubound values and preallocation but we can't get it to work. We also noticed that changing the ubound value has no effect on the size of x and y.
. Thanks again for your help!
Walter Roberson
Walter Roberson el 8 de Jun. de 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
Denis Gurchenkov el 25 de Jul. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Coder en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 7 de Jun. de 2018

Comentada:

el 25 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by