フィルターのクリア

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

7 ビュー (過去 30 日間)
x lang
x lang 2022 年 2 月 2 日
コメント済み: x lang 2022 年 2 月 2 日
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?

採用された回答

Walter Roberson
Walter Roberson 2022 年 2 月 2 日
function PFesti()
persistent pf
if isempty(pf)
pf = stateEstimatorPF;
end
pf.predict();
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by