if nested functions supported in live scripts
조회 수: 4 (최근 30일)
이전 댓글 표시
Are nested functions supported in live scripts? Otherwise, global variables have to be declared as global?
댓글 수: 6
Dyuman Joshi
2024년 2월 27일
A function needs to be called by using its name and providing any inputs required to run it. That is the case in both functions (.m) and live functions (.mlx).
If, a function does not require any input to run, you can run it (.m file) by pressing the green button.
However, that is not the case with live function (.mlx file), for which you need to explicitly call it.
채택된 답변
Cris LaPierre
2024년 2월 27일
편집: Cris LaPierre
2024년 2월 27일
To enable the Run button, at the very top of your live script, call your function.
sl
function sl
...
end
Note that the clear is unnecessary, as your function runs in tis own workspace. It will not have anything in it at this point.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!