From: Walter Roberson <>
User-Agent: Thunderbird (Macintosh/20100228)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab 2010a dir cmd
References: <hsf7bc$f7m$> <hsfab3$rfk$> <RnGGn.6843$wV2.3222@newsfe23.iad> <hsfc8r$1lb$> <hsfcqc$688$>
In-Reply-To: <hsfcqc$688$>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 84
Message-ID: <mPHGn.6332$HG1.3135@newsfe21.iad>
X-Trace: newsfe21.iad 1273710930 (Thu, 13 May 2010 00:35:30 UTC)
NNTP-Posting-Date: Thu, 13 May 2010 00:35:30 UTC
Date: Wed, 12 May 2010 19:35:29 -0500
Xref: comp.soft-sys.matlab:635282

James wrote:
> Yes, you received two quick replies from two people who obviously had no 
> idea what they were talking about...

~ 500> matlab7_ng -nodisplay -nojvm

                             < M A T L A B (R) >
                   Copyright 1984-2008 The MathWorks, Inc.
                          Version (R2008b)
                              September 17, 2008

Warning: X does not support locale en_CA.UTF-8

   To get started, type one of these: helpwin, helpdesk, or demo.
   For product information, visit

 >> dir('*.')

.   ..

 >> !touch foobar.
 >> dir('*.')

.        ..       foobar.

Does that disagree in any way with my statement that,

"It wouldn't be the behavior I would expect on Unix systems, where the 
trailing period would be treated as a literal, and only names ending in 
period would be returned."

Or did I "not know what" I was "talking about" when I stated that "Derik 
was including a period in the name." ? And was the remainder of my 
article not in the form of a question?

 >  or did not attempt to verify your
 > problem before writing to this thread.

If you provide a Windows PC and Matlab license valid for the appropriate 
releases, then I would be happy to test the boundaries of the Windows 

> I recently installed Matlab 2010 and have run into this issue as well.  
> Very frustrating... many legacy scripts no longer work properly as a 
> result of this flaw.  I, too, would be very interested to hear if there 
> is a workaround of any sort available...

I do not see the referenced dir behaviour documented by Mathworks. What 
Mathworks does say,
is that,

"DOS File Names

The MATLAB dir function is consistent with the Microsoft Windows 
operating system dir command in that both support short file names 
generated by DOS."

In DOS, the file names for a directory include a .DIR extension, and the 
names at the Windows level are shown with the .DIR extension striped 
off, including the trailing period. There is thus no documented reason 
to expect that a trailing period is a short cut for indicating 
directories to the dir() command.

I am not doubting that it "happened to work" in the past, but if it did 
then it relied upon undocumented Matlab behaviour.

Is the use of trailing period correct for Windows? Microsoft says not:

 >>> Do not end a file or directory name with a space or a period.
 >>> Although the underlying file system may support such names, the
 >>> Windows shell and user interface does not. However, it is acceptable
 >>> to specify a period as the first character of a name. For example,
 >>> ".temp"

I would not say that there is a workaround -- but there is obvious 
coding that is portable, operating-system independent, and fully 
documented, and thus is _correct_ coding for the situation:

names = dir('*');
names = names([names.isdir]);