フィルターのクリア

Matlab function undefined variable error

4 ビュー (過去 30 日間)
Ahmad Badran
Ahmad Badran 2020 年 10 月 2 日
コメント済み: Ameer Hamza 2020 年 10 月 2 日
Hi i have used matlab function in simulation and the function equation is
function y = ks(u)
y = u*lo;
end
I have difined lo in m.file at the same name of the function "ks"
lo=5;
evry time i eun the simulation i got error "Undefined function or variable 'lo'."

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 2 日
Define lo inside the function
function y = ks(u)
lo = 5;
y = u*lo;
end
  3 件のコメント
Ahmad Badran
Ahmad Badran 2020 年 10 月 2 日
I have tried to make lo as a global but this also does not effevt
Ameer Hamza
Ameer Hamza 2020 年 10 月 2 日
I got the impression that OP is referring to Simulink's MATLAB function block. There are ways to share data from the base workspace, but the easiest is just to define it inside the function block.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by