Matlab Coder : Error using interpolation function interp1(x,y,z,'spline');

2 次查看(过去 30 天)
I am writing a signal processing based algorithm using MATLAB which involves using spline interpolation. It runs perfectly on MATLAB. I am attempting to generate the C++ code for my algorithm. The issue is the following :
In the following line of code :
Vector_A(:,1) = interp1(Matrix_B(:,1),Matrix_B(:,2),equi_sample,'spline');
The matrices and vectors have the following dimensions:
Vector_A = (1024,1);
Matrix_B = (843,2);
equi_sample = (1024,1);
'spline' = (:inf,:inf);
Due to this, I am getting the following error,
Subscripted assignment dimension mismatch (size [1024 x 1] ~= size [:? x :?]).
Can you please help me out to make sure I am able to use interpolation for generating C++ code.
Many Thanks
Regards
Alok

回答(1 个)

Mike Hosea
Mike Hosea 2015-7-7
This all works fine for me. I just tried it in 15a. INTERP1 doesn't need to do anything fancy to figure out the size of the output--it's just the size of equi_sample in this case. I'm going to need more code to figure this out. Make sure you're not using coder.varsize or computing equi_sample in a way that would result in a size that isn't constant.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by