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

1 回表示 (過去 30 日間)
Alok Pathak
Alok Pathak 2015 年 7 月 7 日
回答済み: Mike Hosea 2015 年 7 月 7 日
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 Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by