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

2 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Mike Hosea
Mike Hosea il 7 Lug 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.

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by