I'm trying to get a path to all the jpeg files in a directory including 'fig'. This code below gets all the jpeg files in the directory, however does not exclude any 'rft' labeled files.
base_directory = '/home/user/data/';
directories = dir([base_directory,'/*.jpg']);
filenames = directories;
An example of the directory is
goblet_fig_2004_03_07.jpg
goblet_rft_2004_03_07.jpg
goblet_fig_2004_11_02.jpg
goblet_rft_2004_11_02.jpg
Any help is appreciated.
After help this is my complete code, Notice 'fig.jpg', was the answer I was looking for
base_directory = '/home/user/data/';
directories = dir([base_directory,'*fig*.jpg']);
filenames = directories;
for fileIndex = 1: length(filenames)
image = imread([base_directory,'/',filenames(fileIndex).name]);
end
filenames = dir('*fig*.jpg')
I have tried it on Windows, not Linux, but it should work.