Matlab function undefined variable error
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ahmad Badran
am 2 Okt. 2020
Kommentiert: Ameer Hamza
am 2 Okt. 2020
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'."
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 2 Okt. 2020
Define lo inside the function
function y = ks(u)
lo = 5;
y = u*lo;
end
3 Kommentare
Ameer Hamza
am 2 Okt. 2020
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!