Hello – I found this code from http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F and although it says that any format should work, it will not read any .tif files. Instead it results in the following errors –
- Error using imread>get_format_info (line 491)Unable to determine the file format.
- Error in imread (line 354) fmt_s = get_format_info(fullname);
- Error in Line (line 16) imageArray = imread(fullFileName);
There are no errors when the code is used with .jpg files. Here is the code
% function Line(~,~)
% Specify the folder where the files live.
myFolder = 'C:\Users\Vicki\Documents';% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(myFolder) errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder); uiwait(warndlg(errorMessage)); return;endfilePattern = fullfile(myFolder, '*.tif'); % Change to whatever pattern you need.
theFiles = dir(filePattern);for k = 1 : length(theFiles) baseFileName = theFiles(k).name; fullFileName = fullfile(myFolder, baseFileName); fprintf(1, 'Now reading %s\n', fullFileName); imageArray = imread(fullFileName);endend end
Any help is much appreciated.
Best Answer