Using coder.extrinsic with "spectrum.periodogram" in simulink?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to incorporate a matlab function into a simulink model; I've pasted the function into a "Matlab function" simulink block, but it won't run due to various functions not being supported for standalone code generation.
Here's the start of the function:
function [found, m] = FFTscan( signal, Fs )
Hs=spectrum.periodogram;
PSD=psd(Hs,signal,'Fs',Fs); %creates FFT of signal
psd(Hs,signal,'Fs',Fs)
released=PSD.Data; %strips values from FFT
PSDn=released./max(released); %normalizes values from FFT
...
Returns the following error:
The function 'spectrum' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation.
Function 'Subsystem1/Algorithm/MATLAB Function' (#22.166.174), line 7, column 4:
"spectrum"
Launch diagnostic report.
I've tried appending the above code with:
coder.extrinsic('spectrum', 'psd');
But the block still throws the same error. Does anyone know how I can go about using these functions in simulink?
Thanks,
-Will
댓글 수: 0
채택된 답변
Arnab De
2013년 2월 12일
From your code, it appears that spectrum is not a function, but a class. coder.extrinsic declaration does not work with classes. You need to wrap uses of that class in a function and declare that function extrinsic.
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!