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

2 views (last 30 days)
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

Answers (1)

Mike Hosea
Mike Hosea on 7 Jul 2015
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.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!