Importing files in folder into listbox and opening one at a time
12 views (last 30 days)
I would like to be able to load a folder which contains multiple files into a listbox in the app designer. The files in this listbox should then be able to be opened and read by the GUI.
The GUI I've designed has the reading cabaility if I open each file manually but I would like to be able to populate a listbox with all the files first, and then read adn access ach one individually.
Any help would be greatly appreciated!
Payas Bahade on 9 Apr 2020
I have written a code to import multiple files from folder into listbox. I have added startupFnc to import files into the listbox. You will need to add this function in your file reading capability code. For illustraton purpose, I have used ListBoxValueChanged callback to read data from files.
% Code that executes after component creation
fileExtPattern = fullfile('EnterYourPathHere'); %Enter path eg. 'C:\Users\XYZ\Desktop\myFolder'
dirInfo = dir(fileExtPattern);
Please refer documentation of fullfile and dir for more details. I have also attached the .mlapp file for reference.
Hope this helps!