GUI - Populating listbox with File List

1 Ansicht (letzte 30 Tage)
onamaewa
onamaewa am 17 Okt. 2019
Kommentiert: Adam am 17 Okt. 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 Kommentar
Adam
Adam am 17 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by