Using coder.extrinsic with "spectrum.periodogram" in simulink?

1 visualización (últimos 30 días)
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

Respuesta aceptada

Arnab De
Arnab De el 12 de Feb. de 2013
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.

Más respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by