MATLAB is calling the wrong function, but the 'which' command gives me the right one. How to fix?

7 vues (au cours des 30 derniers jours)
I am trying to debug some code by taking a local copy of a particular function and getting MATLAB to call this one. However it is not working. Example: fvcustom is an object that multiple other objects use, but it has a bug. I take a local copy of fvcustom and a 'which' command confirms that this is the highest version in my path
>> which fvcustom
my_local_path\fvcustom.m
However when I try to debug and call a parent object to fvcustom, it calls the function in the central repository which I can't edit:
repo\fvcustom.m
Can anyone help me out with this? I must be doing something stupid.
Thanks

Réponse acceptée

Rob Holmes
Rob Holmes le 4 Sep 2015
OK there is still an issue there, but I've applied a workaround which is kind of similar to Star Strider's second comment.
  1. take a local copy of the entire central repository
  2. remove the central repo from my path
  3. MATLAB cannot now see the central repo and so does not get confused

Plus de réponses (2)

Star Strider
Star Strider le 4 Sep 2015
Call:
which fvcustom -all
or:
Q = which('fvcustom','-all')
to find all of them. The function form returns a cell array with the full path to each of them.
  4 commentaires
Rob Holmes
Rob Holmes le 4 Sep 2015
Thanks. Did something similar in the end (removed the whole repo from my path after taking a local copy)

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 4 Sep 2015
Try using the path tool (on the toolbar) to change the order of the search path to put the one you want first.

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by