Pretty Crazy uigetfile bug?
1 次查看(过去 30 天)
显示 更早的评论
Spent hours trying to figure out why my script written in 2012a gave weird results in 2012b. Finally found it.....
So....uigetfile returns a cell array of filenames, we all know that. In 2012a, if three files are selected (eg 1.xls, 2.xls, 3.xls), it would return an array of filenames with the first called '1.xls', second '2.xls' and third '3.xls'.
Apparently, in 2012b, the filenames array now becomes 3.xls, 1.xls, 2.xls
Can anyone corroborate this ?
0 个评论
回答(2 个)
the cyclist
2013-2-8
编辑:the cyclist
2013-2-10
I'm using the prerelease version of 2013a (but guessing the behavior is the same as 2012b) on Mac OS X 10.8.2.
In very, very limited testing, I am finding that the order seems to be determined by the order the files are listed in the GUI. So, for example, I could get either 1,2,3 or 3,2,1 depending on whether I did the sorting by filename or by the date-last-modified.
Jan
2013-2-10
The order of outputs is to defined in the documentation. Even the output of e.g. the operating systems or Matlab's DIR command under Windows is not defined. The fact, that all tests seems like after . and .. the filenames are sorted alphabetically does not mean, that another order is a "crazy bug".
The graphical part of uigetfile relies on a Java class, depending on the value of usejavadialog. You can insert a sort() in uigetputfile_helper on demand. But it would be cleaner to perform the sorting in your program, when it is required there.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!