Matlab: how to find functions on path that use a given function

前端 未结 4 1025
情话喂你
情话喂你 2021-02-08 08:51

It sometimes happens that I need to change the behavior of a function. Is there an easy way to find functions (on the matlab path) that use that function?

4条回答
  •  被撕碎了的回忆
    2021-02-08 09:37

    I would use a tool like grep. I posted a tool called mgrep on the file exchange a few years ago. It can search through entire directories of m-files for any given string, and it searched recursively down into sub-directories. So to find functions in my directories that call fminsearch, I would merely execute this at the command line.

    mgrep('fminsearch','.','show','off') Searching directory(ies)...

    /Users/woodchips/Desktop/My_FEX/cylinderfit.m /Users/woodchips/Desktop/My_FEX/fminspleas.m /Users/woodchips/Desktop/My_FEX/fminspleas2.m /Users/woodchips/Desktop/My_FEX/fminspleas3.m /Users/woodchips/Desktop/My_FEX/fminspleasnnls.m /Users/woodchips/Desktop/My_FEX/BoundedFSOLVE/fsolvebnd.m /Users/woodchips/Desktop/My_FEX/FMINSEARCHBND/fminsearchbnd.m ...

提交回复
热议问题