how do i keep the click order on a uigetfile selection?

28 vues (au cours des 30 derniers jours)
mat
mat le 5 Oct 2014
Commenté : Geoff Hayes le 6 Oct 2014
hi,
how can i keep the files in the uigetfile in the order in which they were chosen (clicked on)?
thanks a lot!
mat

Réponses (1)

Geoff Hayes
Geoff Hayes le 5 Oct 2014
Mat - I don't think that you can maintain that order using the uigetfile as is. The order in which the files are returned (when using multi-select) is dependent upon the order in which they appear in the dialog. If the files are sorted alphabetically, by size, by modified date, etc., then that is the order in which the selected files are returned.
A similar question was raised at 131684-load-multiple-files-into-gui-in-specific-order and a proposed solution was to use a listbox to manage the list of files to be chosen (assuming all files were to be selected from the same folder).
  2 commentaires
mat
mat le 5 Oct 2014
hi geoff,
thanks for your kind answer. could you please elaborate on the listbox solution?
thanks again,
mat
Geoff Hayes
Geoff Hayes le 6 Oct 2014
Hi Mat - the idea is that you have a listbox that contains all files (or rather their names) that you could allow the user to select from. Whenever the user selects (or deselects) a file, the callback to the listbox fires and you would have to consider the new index of the selected (or deselected) file and add it to (or remove it from) a list of the ids that you maintain and is ordered given the user selections. You could have a push button that would then "get the files" in the selected order, which the user would press once all files have been selected.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Dialog Boxes dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by