question of 'uigetfile' command order

Hi everyone. I was confused about the order in 'uigetfile'. When I use this commend to open multiple files, like: filename = uigetfile('*.mat', 'Pick a file', 'MultiSelect', 'on'); maybe more than 100 files. And I use these data to build a matrix and then to plot a figure. Then in this figure I found that maybe one of my data is specific and I need to pick it out. But all I know is which row this data in my matrix but can't match it to the data in my file cause I don't know the order of opening the data.Is there anyone could help me? Thanks

3 Comments

Zhang - can't you keep the list of files that uigetfile has returned to you? Presumably row k of your matrix will correspond to the kth file in that file list...
Actually I found that the order in matrix doesn't match it in files. For example, I found the 9th data is what I need, but the 9th data in file doesn't match the 9th row in matrix. That's the matter.
You do not tell us about how you create rows of your matrix from your input files.

Sign in to comment.

 Accepted Answer

Stephen23
Stephen23 on 13 Jul 2018
Edited: Stephen23 on 15 Jul 2018
The uigetfile help states that "File names in the cell array are sorted in the order that that the user's platform uses", which is basically undefined for Windows. You could download and sort the filenames using my FEX submission nastsortfiles:

1 Comment

Thanks for your answer.My solution is save the filename() as a .mat file and when I got some troubles of data, just check the filename I saved. A little bit inconvenient, but works.

Sign in to comment.

More Answers (0)

Categories

Find more on App Building 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!