필터 지우기
필터 지우기

Matlab function undefined variable error

조회 수: 3 (최근 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 CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by