GUI - Populating listbox with File List

1 visualizzazione (ultimi 30 giorni)
onamaewa
onamaewa il 17 Ott 2019
Commentato: Adam il 17 Ott 2019
I have inseted a Click and List Box in GUI.
Procedurally, I would like to click the Click Box to open the computer's File Directory, select a file, and have its contents populate the Listbox.
Reading the documentation, I've tried implementing lbox2 and lbox1 but haven't been successful.
How can I achieve this?
  1 Commento
Adam
Adam il 17 Ott 2019
doc uigetdir
will let you search for a directory
doc dir
will let you manipulate the information content of a directory, such as the listing of files and filter out stuff you don't want (e.g. '.' and '..' or all subfolders etc).
If you want to read the contents of a file then there are various ways to do that depending what type of file it is, but once you have it all in a string or cell array of strings/chars you can just assign it to the 'String' property of your listbox.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Environment and Settings 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