How to use only specific files in directory in GUI?

4 visualizzazioni (ultimi 30 giorni)
HC il 14 Feb 2019
Commentato: HC il 15 Feb 2019
Hello all.
I have a GUI function that can open a directory/folder of images. What I would like to do is actually only select the files/images with the word "PU" in their titles. How would I be able to do this/approach this problem?
Thank you.
  2 Commenti
HC il 15 Feb 2019
It is using uigetdir, yes. Within that folder/directory, I want to open only specific images with the title "PU".

Accedi per commentare.

Risposte (2)

Jan il 15 Feb 2019
folder = uigetdir('Choose a folder');
List = dir(fullfile(folder, 'PU*.*'));
FileName = fullfile(folder, {});
for iFile = 1:numel(FileName)
File = FileName{iFile}
... now open it

Robert il 15 Feb 2019
Not sure what you mean by 'select', but you can show a user only the files containing 'PU' in their titles using
[fileName, pathName] = uigetfile('*PU*', 'This is my dialog title', 'MultiSelect', 'on');
  1 Commento
HC il 15 Feb 2019
In the GUI, I have a "Select Directory" button. This button pulls up all of the images/files in that directory/folder onto the GUI. I only want this button to choose (or "pull up" on the GUI) files with "PU" in the title.

Accedi per commentare.


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