Why does MATLAB select the wrong function or model if I have more than one function with the same name?

조회 수: 2 (최근 30일)
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.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
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개)

카테고리

Help CenterFile Exchange에서 Using MATLAB Projects in Simulink에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by