Filter löschen
Filter löschen

How can I force which shadowed function will be called without using packages?

19 Ansichten (letzte 30 Tage)
I have a function with the same name as a function in one of MATLAB's add-on toolboxes. I'm not able to change the library this function is part of to a package. I want to be able to specify which function will be called (either the library version or the one in the toolbox). One solution is to remove the library/toolbox from the MATLAB path temporarily, but ideally, this would be handled programatically with both still remaining on the MATLAB path. How can I do this?
  4 Kommentare
Rik
Rik am 24 Feb. 2022
It sounds as if you're talking about a third party toolbox. Could you confirm this?
And can you show the output of this?
clc,which $FunctionName$ -all
Kyle Padilla
Kyle Padilla am 24 Feb. 2022
It's not a third party toolbox. I can't give specifics on which toolbox or function it is, but here is the output:

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 24 Feb. 2022
If you are in control over all places where the target function is going to be called, then what you can do is:
cd to the directory with the shadowed function. Use @ to take a handle to the shadowed function. cd back. Now you can use that handle to call the shadowed function.
However, if the target function is being called from other functions, and what you want to do is sort of "turn on" and "turn off" resolution to one location or another, then you will have a problem unless you manipulate the MATLAB path.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by