Peculiar behavior of lookfor

8 vues (au cours des 30 derniers jours)
dpb
dpb le 17 Sep 2014
Commenté : dpb le 18 Sep 2014
Given the following function definition
function is=isleapyr(yr)
% returns T for input date being a leapyear
is=(datenum(yr+1,1,1)-datenum(yr,1,1))==366;
Why the following output from lookfor?
>> lookfor leap
isleapyr - returns T for input date being a leapyear
isleapyr - returns T for input date being a leapyear
>> help isleapyr
returns T for input date being a leapyear
>>
That is, where does the doubled listing come from? I've ensured there's only one copy of isleapyr.m extant in the entire Matlab installation directory. It's annoying and apparently some sort of a bug???? OBTW, R2012b.
Well, the latter comment got me thinking -- so I copied the file to a working directory in my old R12 release and voila!!
>> lookfor leap
isleapyr.m: % returns T for input date being a leapyear
>> isleapyr(2004)
ans =
1
>> which isleapyr
C:\matlabR12\work\isleapyr.m
>>
So it appears to be some sort of introduced bug. Anybody else confirm still extant before I submit official report?
  7 commentaires
dpb
dpb le 17 Sep 2014
Modifié(e) : dpb le 17 Sep 2014
I think your last supposition is correct...I hadn't noticed it was everything in the current directory with the problem previously. I just submitted the bug report; I referenced/linked to the thread here so if TMW will read it they'll see the comment. Of course, it shouldn't take long for them to uncover the recursion problem somebody introduced.
ADDENDUM
Just confirmed your hypothesis--moving out of the current directory causes the symptom to disappear.
A Jenkins
A Jenkins le 17 Sep 2014
I get the same behavior on 2010a and 2008a as well, so I'm not sure we can say it was recently introduced...

Connectez-vous pour commenter.

Réponses (1)

per isakson
per isakson le 17 Sep 2014
Modifié(e) : per isakson le 17 Sep 2014
If the current directory is in the path lookfor seems to scan it twice
A little experiment in R2014a
>> version
ans =
8.3.0.532 (R2014a)
With the current directory being the folder with isleapyr
>> lookfor leap
isleapyr - returns T for input date being a leapyear
isleapyr - returns T for input date being a leapyear
leapyear - Determine leap year.
decaydimer - Comparing SSA and Explicit Tau-Leaping Stochastic Solvers
and the current being another folder
>> lookfor leap
isleapyr - returns T for input date being a leapyear
leapyear - Determine leap year.
decaydimer - Comparing SSA and Explicit Tau-Leaping Stochastic Solvers
  3 commentaires
per isakson
per isakson le 18 Sep 2014
"earlier" &nbsp I guess it took me too long experimenting and that you posted the comment during that period of time.
dpb
dpb le 18 Sep 2014
Looks roughly same time as D Young's observation but I didn't see yours until later...I'd not noticed earlier that it was only in the working directory that it occurs so that was a good catch by both of you.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by