Good day. Please what is the difference between a script file and a function file, and in which case or situation is either one preferred above the other?
조회 수: 1 (최근 30일)
이전 댓글 표시
There are some programs that can be written in both script and function file. So I want to know which is more preferable. I want to the situation when I need to choose one above the other.
댓글 수: 0
답변 (1개)
ES
2018년 3월 16일
Generally Functions are better because they have defined interfaces do not interfere with base workspace unless explicitly coded, and are faster (because they are not interpreted everytime they are run).
But the answer really depends on your use case.
https://in.mathworks.com/help/matlab/matlab_prog/scripts-and-functions.html
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!