How to import all files in a folder with the files having non-sequential and irregular names

Currently, the code below imports two different files from different directories using an import function created with the Matlab import data wizard. This currently works fine for a single file from each directory, but I would like to import multiple files from each directory and either:
1- make matrix "a" and "b" three-dimensional with the third dimension signifying a new file's data or,
2- create numbered matrices (1,2,3...n) of each of the file's data. For this option, the order of the files and the numbers does not matter, because I will be pulling all similar data together and re-ordering the combined file later by one column of its contents.
Keep in mind, the files all have irregular names, but the same extension.
% first type of data
filename = 'C:\Users\blah\blah\blah_1\irregular_filename.regular_file_extension';
data = import_function_v1(filename);
a = table2array(data);
% Second type of data
filename = ''C:\Users\blah\blah\blah_2\irregular_filename.regular_file_extension';
data = import_function_v1(filename);
b = table2array(data);
Please let me know if I need to post more information.
Thanks for the help,
Jesse

Answers (0)

Categories

Products

Asked:

on 24 Sep 2015

Edited:

on 24 Sep 2015

Community Treasure Hunt

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

Start Hunting!