2

I would need to find all the places in my code (several M files in a folder) where I used a particular function (unique in this case).

Do you know if it is possible?

chappjc
  • 30,359
  • 6
  • 75
  • 132
gabboshow
  • 5,359
  • 12
  • 48
  • 98
  • possible duplicate of [Tool to recursively search all files in a directory for a string](http://stackoverflow.com/questions/1266796/tool-to-recursively-search-all-files-in-a-directory-for-a-string) or an older version with better answers: http://stackoverflow.com/questions/317944/tools-to-search-for-strings-inside-files-without-indexing – Dan Feb 12 '14 at 12:12
  • 1
    If the `Matlab` tag is meaningful, then these are not exact duplicates. – Jonas Feb 12 '14 at 12:24

4 Answers4

6

In Matlab, there is the command "Find Files" - in the "Edit" menu, or on the "Home" and "Editor" ribbon - that allows you to find files containing specific text, either in a folder or on the entire Matlab path:

enter image description here

Jonas
  • 74,690
  • 10
  • 137
  • 177
3

Use the "find in files" function in Notepad++

paghdv
  • 554
  • 1
  • 4
  • 14
1

If you want to check what functions you're using, depfun allows you to do so, although it might be overkill if you only want to check for a single known function.

For example (checking functions called directly by a function only):

[list builtins] = depfun(fun, '-toponly');
nkjt
  • 7,825
  • 9
  • 22
  • 28
0

"which" seems to do it.

Take a look at this: http://www.mathworks.co.uk/help/matlab/ref/which.html (1st example)

Otherwise, notepad++ allows you to search (and replace) multiple files for a text string, here's a simple tutorial: http://www.makeuseof.com/tag/how-to-find-and-replace-words-in-multiple-files/

Jerome
  • 23
  • 5
  • `which` only allows you to find functions, not instances inside files where specific functions are called. – Jonas Feb 12 '14 at 12:26