Borrar filtros
Borrar filtros

How to save classes in matlab in persistent variables during code generation

6 visualizaciones (últimos 30 días)
If objects are stored in persistent variables, initialize System objects once by embedding the object handles in an if statement with a call to isempty().
How to implement this sentence
function PFesti()
if(isempty(pf@stateEstimatorPF))
pf = stateEstimatorPF;
else
pf.predict();
end
end
I wrote these codes above but it doesn't work, does anyone know how matlab's classes are initialized only once after the embedded code is generated?

Respuesta aceptada

Walter Roberson
Walter Roberson el 2 de Feb. de 2022
function PFesti()
persistent pf
if isempty(pf)
pf = stateEstimatorPF;
end
pf.predict();
end

Más respuestas (0)

Categorías

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

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by