GUI - Populating listbox with File List

6 次查看(过去 30 天)
onamaewa
onamaewa 2019-10-17
评论: Adam 2019-10-17
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 个评论
Adam
Adam 2019-10-17
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by