Is it possible to call a function that doesn't have precedence?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am aware of Matlab's Function Precedence Order. It appears that the only way to call a function that isn't on the path, or has lower precedence on the path, is to change directories so that it has precedence.
However, I am trying to write a function, 'someFunc', that extends an older version of 'someFunc' (and is actually a protected .p file). Unfortunately, the original 'someFunc' indirectly calls itself (it calls another function which then calls it again). This means the technique of changing directories to call the original 'someFunc' won't work, since all recursive calls then call the original 'someFunc' not the new 'someFunc' (since it is in the current directory). Moreover, since 'someFunc' isn't directly recursive, I can't use a private function to override the precedence either.
I was hoping to use a function handle to call the original function instead of changing directories, but that doesn't work either, as outlined here.
댓글 수: 0
채택된 답변
Sean de Wolski
2015년 6월 26일
You could put it in a package and then import the package (import pack.somefunc) or call directly into the package (pack.somefunc()).
댓글 수: 3
Sean de Wolski
2015년 6월 29일
You can learn more about your class by looking at metaclass() of it (also the ?)
mc = pkg.class
Then inspect mc to learn what the restrictions are.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Software Development Tools에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!