GUI - Populating listbox with File List
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Adam
el 17 de Oct. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!