what is the meaning of following code?

1 view (last 30 days)
temp = imread(strcat('output/img', num2str(4*i + j), '.tif'));

Answers (1)

John D'Errico
John D'Errico on 29 Jan 2019
Edited: John D'Errico on 29 Jan 2019
When you don't understand a line of code, take it apart. Start on the inside most part.
4*i+j : Variables named i and j must exist. 4*i+j does what it looks like, i.e., arithmetic.
num2str(4*i+j): convert that number to a string form
'output/img' : a string
'.tif': Another string
strcat('output/img', num2str(4*i + j), '.tif'): Combine those strings into one string.
Finally, imread does what you think it should do. It reads in an image, with name that was created by the preceding operations.

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!