Why does MATLAB select the wrong function or model if I have more than one function with the same name?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Why does MATLAB select the wrong function or model if I have more than one function with the same name?
If I overload a function or model name, MATLAB sometimes selects the wrong one. This even happens if I am in the directory containing the model or function that I want to run.
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
This results from the way MATLAB searches for files. If you have more than one file, or model with the same name, MATLAB will always load the one that is nearest the top of your path list.
The way around this is:
- Make sure your models/functions have different names (recommended), or
- Place the path of the model/function needed above the path of the overloaded model/function
- Change to the directory where the model/function you want is placed.
To see your path listing type 'path' at the MATLAB prompt.
To see all the listings of a specific model or function name, type
which -all modelname
where 'modelname' is the name of your model or function without the suffix .mdl or .m.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Using MATLAB Projects in Simulink finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!