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 commentaires

Geoff Hayes
Geoff Hayes le 13 Juil 2018
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...
Zhang Shiming
Zhang Shiming le 13 Juil 2018
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.
Walter Roberson
Walter Roberson le 13 Juil 2018
You do not tell us about how you create rows of your matrix from your input files.

Connectez-vous pour commenter.

 Réponse acceptée

Stephen23
Stephen23 le 13 Juil 2018
Modifié(e) : Stephen23 le 15 Juil 2018

0 votes

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 commentaire

Zhang Shiming
Zhang Shiming le 18 Juil 2018
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by