Pretty Crazy uigetfile bug?

1 visualización (últimos 30 días)
Rainer
Rainer el 8 de Feb. de 2013
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 ?

Respuestas (2)

the cyclist
the cyclist el 8 de Feb. de 2013
Editada: the cyclist el 10 de Feb. de 2013
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.
  1 comentario
Rainer
Rainer el 9 de Feb. de 2013
Editada: Rainer el 9 de Feb. de 2013
Hmmmm, I tried sorting it on dates etc and it doesnt make a difference. In fact, it doesn't make a difference if I highlighted each file separately or in whatever order I selected them. (Windows XP)

Iniciar sesión para comentar.


Jan
Jan el 10 de Feb. de 2013
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.
  1 comentario
Rainer
Rainer el 10 de Feb. de 2013
You are right. The documentation says: "File names in the cell array are sorted in the order your platform uses."
Here is what happened to me:
Computer 1: Win7, matlab2012a...returns order 1,2,3
Computer 2: WinXP, matlab2012b..returns order 3,1,2
I guess Win7 handles it differently from WinXP.

Iniciar sesión para comentar.

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by