Importing files in folder into listbox and opening one at a time
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
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!
Thanks :)
0 comentarios
Respuestas (1)
Payas Bahade
el 9 de Abr. de 2020
Hi George,
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
function startupFcn(app)
fileExtPattern = fullfile('EnterYourPathHere'); %Enter path eg. 'C:\Users\XYZ\Desktop\myFolder'
dirInfo = dir(fileExtPattern);
app.FIlenamesListBox.Items ={dirInfo.name};
end
Please refer documentation of fullfile and dir for more details. I have also attached the .mlapp file for reference.
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps 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!