Matlab Coder : Error using interpolation function interp1(x,y,z,'spline');
조회 수: 1 (최근 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
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!