calling a sequence of images for processing

3 次查看(过去 30 天)
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??

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by