What is the Order of Function Precedence in MATLAB 2019b or 2020a?

조회 수: 5 (최근 30일)
Kareem Elgindy
Kareem Elgindy 2020년 6월 20일
댓글: Kareem Elgindy 2020년 6월 20일
If I put a .m file in the current directory or in MATLAB search path, and then call it from the MATLAB Command Window, would MATLAB look for certain file types (e.g. built-in functions) in certain directories first before it searches for the required file? For example, suppose I created a file and called it anything like u1 and then put u1 in the current directory or in MATLAB search path. Now, when I call u1 and say the built-in sine function sin from the Command Window, would MATLAB invoke sin faster than it would for u1?

채택된 답변

Rik
Rik 2020년 6월 20일
I don't know what you would mean by 'faster'.
  댓글 수: 3
Rik
Rik 2020년 6월 20일
I would expect Matlab would search this list until it found a match for the first call, but a second call within the same function will skip that search. There is a lot of optimization happening under the hood, so the difference in timing could change within subsequent calls.
Kareem Elgindy
Kareem Elgindy 2020년 6월 20일
This was very helpful. Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by