function images=load_images(img_path) if ~isdir(img_path) errorMessage = sprintf('Error: Folder not found:\n%s', img_path); uiwait(warndlg(errorMessage)); return; end files = fullfile(img_path, '*.jpg'); img = dir(files); n=length(img); for k = 1:n images{k,1}=img(k).name; end