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

18 visualizzazioni (ultimi 30 giorni)
hi,
how can i keep the files in the uigetfile in the order in which they were chosen (clicked on)?
thanks a lot!
mat

Risposte (1)

Geoff Hayes
Geoff Hayes il 5 Ott 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 Commenti
mat
mat il 5 Ott 2014
hi geoff,
thanks for your kind answer. could you please elaborate on the listbox solution?
thanks again,
mat
Geoff Hayes
Geoff Hayes il 6 Ott 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.

Accedi per commentare.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by