Matlab R2018b cannot check whether builtin function 'addvars.m' exist
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I found that Matlab R2018b cannot check whether the builtin function 'addvars.m' exist. On my machine:
>> exist('addvars.m')
ans =
0
>> exist('addvars')
ans =
0
>> exist('plot')
ans =
5
However, if I type:
edit addvars
It can open this builtin function (C:\Program Files\MATLAB\R2018b\toolbox\matlab\datatypes\@tabular\addvars.m). I need to check whether it exists to make my code backward compatitable. What is the reason for this issue?
Edit: A screenshot
![addvarsbug.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/199716/image.png)
0 Kommentare
Antworten (3)
madhan ravi
am 25 Dez. 2018
https://www.mathworks.com/help/matlab/ref/exist.html#description - reason is given.
P.S - I received the same answer as you(2018b).
0 Kommentare
Walter Roberson
am 25 Dez. 2018
The inside of @ directories are not considered to be on the search path. When exist() is passed a file name, it only examines the search path. When exist() is passed the name of a function, it only examines the search path.
The addvars that exist() is finding is considered a method of class tabular
0 Kommentare
Steven Lord
am 25 Dez. 2018
Instead of checking the existence of a particular file, I recommend using the verLessThan function to determine if the MATLAB session you're using is sufficiently new to have a particular piece of functionality. This avoids false positives where your user may create a script, function, or class file named addvars in a release earlier than its introduction as a method for table and timetable arrays in release R2018a.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Software Development Tools finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!