tags:

views:

74

answers:

4

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?

+1  A: 

Start with help deprpt.

EDIT: when I run a dependency report there are 3 checkboxes at the top of the report window. One of these, by default unchecked, is called 'Show parent functions (current folder only)'. That is probably the beginning of what you want but it only works in a single folder.

If you want more than that, I suggest that you try edit deprpt.m.

High Performance Mark
deprpt does the opposite from what I want: it finds files that given file depends upon - or maybe I missed something?
Alain
@Alain: I think you did miss something, see the edit I made.
High Performance Mark
This should really be the accepted answer. +1
Doresoom
@Doresoom: My solution works for the entire Matlab path, so I don't think it's that much worse than an incomplete solution. Still, +1 to cancel out the -1
Jonas
@Jonas: I completely agree your solution is effective - got my vote. Sorry, personal preference just showing through here.
Doresoom
A: 

you mean like looking for dependencies? that would be tools -> show dependency report

stupid_idiot
tools -> show dependency report does the opposite of what I want: it finds files that given file depends upon
Alain
+5  A: 

The way I do this is to look for files that contain the name of the function I'm interested in. Thus, I don't only see who calls my function, but also what signature they use.

In the editor: Edit->Find Files

Jonas
+1 somehow I never knew this existed, Thanks Jonas! Usually I use an external tool `Agent Ransack` to search for text in files..
Amro
+2  A: 

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 ...

woodchips

related questions