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 件のコメント

Matt J
Matt J 2014 年 9 月 17 日
編集済み: Matt J 2014 年 9 月 17 日
What happens when you do
>>which -all isleapyr
in your original setup?
dpb
dpb 2014 年 9 月 17 日
編集済み: dpb 2014 年 9 月 17 日
>> which -all isleapyr
c:\ML_R2012b\work\isleapyr.m
>> ver
MATLAB Version: 8.0.0.783 (R2012b)
...
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
...
MATLAB Version 8.0 (R2012b)
Curve Fitting Toolbox Version 3.3 (R2012b)
Optimization Toolbox Version 6.2.1 (R2012b)
Signal Processing Toolbox Version 6.18 (R2012b)
Statistics Toolbox Version 8.1 (R2012b)
>>
Just in case somebody compares versions/toolboxen/etc....
David Young
David Young 2014 年 9 月 17 日
I get the double listing too, in 2013b:
>> lookfor harris-stephens
corners_hs - Simple implementation of the Harris-Stephens corner detector.
corners_hs - Simple implementation of the Harris-Stephens corner detector.
>> which -all corners_hs
C:\Users\davidy\Documents\MATLAB\corners_hs.m
but it doesn't seem to happen for every file, even if they're in the same directory as this one, and I haven't figured out what the difference is.
dpb
dpb 2014 年 9 月 17 日
OK, that's enough for me to be convinced they've introduced a bug--I'll submit a bug report.
Guess if anybody else can figure out the problem or a workaround they can add it here.
David Young
David Young 2014 年 9 月 17 日
Oh maybe it is the same for all files in the directory. It looks like what's happening is that it's looking at the current directory, and then also at the directories on the path, including possibly the current directory.
dpb
dpb 2014 年 9 月 17 日
編集済み: dpb 2014 年 9 月 17 日
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 2014 年 9 月 17 日
I get the same behavior on 2010a and 2008a as well, so I'm not sure we can say it was recently introduced...

サインインしてコメントする。

回答 (1 件)

per isakson
per isakson 2014 年 9 月 17 日
編集済み: per isakson 2014 年 9 月 17 日

2 投票

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 件のコメント

dpb
dpb 2014 年 9 月 17 日
As noted earlier, I confirmed that with R2012b here as well.
It's now narrowed down to after R12 (ca 1999/2000) which works as expected here and R2008a which is the earliest another poster has documented to have the issue.
per isakson
per isakson 2014 年 9 月 18 日
"earlier" &nbsp I guess it took me too long experimenting and that you posted the comment during that period of time.
dpb
dpb 2014 年 9 月 18 日
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.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Search Path についてさらに検索

質問済み:

dpb
2014 年 9 月 17 日

コメント済み:

dpb
2014 年 9 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by