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 Center および File ExchangeUsing 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