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

19 次查看(过去 30 天)
hi,
how can i keep the files in the uigetfile in the order in which they were chosen (clicked on)?
thanks a lot!
mat

回答(1 个)

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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by