how do i keep the click order on a uigetfile selection?
18 views (last 30 days)
Show older comments
hi,
how can i keep the files in the uigetfile in the order in which they were chosen (clicked on)?
thanks a lot!
mat
0 Comments
Answers (1)
Geoff Hayes
on 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 Comments
Geoff Hayes
on 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.
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!