calling a sequence of images for processing

3 views (last 30 days)
I have a part of my code shown below which allocates the file name of a sequence of images so that it can be read with the imread command but for some reason it adds a space inside the file name so the name is invalid:
if k ~= 1
if k < 10
num = k - 1;
file_num = strcat('0',num,'.')
else
file_num = strcat(num,'.');
end
image_file_name = strcat(file, image_name, file_num,'jpg');
M = imread(image_file_name);
else
file_num = '00';
end
And it gives me the error:
Error using imread (line 350)
File "C:\Users\bostock_h\Documents\Images\i130614_075_large\i130614_074-1000 .jpg" does not exist.
Error in image_processing_project4 (line 61)
M = imread(image_file_name);
So as you can see there is a break after the file number with a space. But I don't know where it's coming from??

Accepted Answer

Matt J
Matt J on 15 Jul 2013
Perhaps you meant
num = num2str(k - 1);

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!