[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing character
From: |
Lutz Mager |
Subject: |
[Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling |
Date: |
Mon, 07 Mar 2016 17:57:49 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.gnu.org/bugs/?47359>
Summary: fileattrib wildcard/globbing characters handling
Project: GNU Octave
Submitted by: rocketsound
Submitted on: Mo 07 Mär 2016 17:57:48 GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: rocketsound
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.0.1-rc1
Operating System: Microsoft Windows
_______________________________________________________
Details:
The core function fileattrib handles the wildcard character * differently then
Matlab does, with respect to finding subdirectories and -files. I noticed this
while search for an easy way for finding all subdirectories that lie in a
given root directory.
Let's say we have to the following directory and file structure:
RootDir
|__Dir1
|__Subdir1
|__MyText.txt
|__Subdir2
|__Dir2
The following script will produce different outputs in Octave or Matlab.
[status, result, msgid] = fileattrib('C:\RootDir\*');
for i = 1:length(result)
if (result(i).directory)
fprintf('%s\n', result(i).Name);
end
end
Octave's output:
C:\RootDir\Dir1
C:\RootDir\Dir2
Matlab's output:
C:\RootDir\Dir1\Subdir1
C:\RootDir\Dir1\Subdir2
C:\RootDir\Dir1
C:\RootDir\Dir2
A slightly altered version of the script (notice the second wildcard below)
will find the directories one layer below in Octave but will trigger an error
in Matlab.
[status, result, msgid] = fileattrib('C:\RootDir\*\*');
for i = 1:length(result)
if (result(i).directory)
fprintf('%s\n', result(i).Name);
end
end
Again, Octave's output:
C:\RootDir\Dir1\Subdir1
C:\RootDir\Dir1\Subdir2
And the output of Matlab:
??? Improper index matrix reference.
Error in ==> mytest at 4
if (result(i).directory)
You get the point. Octave's fileattrib follows an other logic then Matlab's
version does.
Tested this on Windows XP and 7.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47359>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling,
Lutz Mager <=
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Lutz Mager, 2016/03/07
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Rik, 2016/03/07
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Mike Miller, 2016/03/07
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Rik, 2016/03/07
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Rik, 2016/03/07
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Lutz Mager, 2016/03/07
- [Octave-bug-tracker] [bug #47359] fileattrib wildcard/globbing characters handling, Mike Miller, 2016/03/25