Images Call within For Loop

2 views (last 30 days)
KALYAN ACHARJYA
KALYAN ACHARJYA on 27 May 2017
Edited: Stephen23 on 27 May 2017
Can you help me out:
Images call within for loop k...k values increasing. Already For loop is running original images call, both folders having a same number of images.This approach working in the initial part of code to call original images.

Accepted Answer

Jan
Jan on 27 May 2017
Edited: Jan on 27 May 2017
The error message is clear: you try to access the k.th element of manual_images, but this array has less than k elements. This can have many reasons, but they cannot be found in the code snippet you have posted.
Prefer fullfile instead of "[manual_directory, '/*.gif']". I assume the code is working inspite of the wrong file separator, but fullfile would adjust this.
  4 Comments
KALYAN ACHARJYA
KALYAN ACHARJYA on 27 May 2017
Thanks a lot, I will try. I am thinking about another alternative as following-
i1=imread(complete path\Manual_Result'num2str(k)'.gif']);
Is this correct approach?
Stephen23
Stephen23 on 27 May 2017
Edited: Stephen23 on 27 May 2017
"I assume the code is working inspite of the wrong file separator"
Actually every single version of Windows API since DOS 2.0 have accepted both \ and / as file path separators (note: as opposed to in the command line): "Contrary to popular belief, the Windows system API accepts slash, and thus all the above Unix examples should work. But many applications on Windows interpret a slash for other purposes or treat it as an invalid character, and thus require you to enter backslash — notably the cmd.exe shell (often called the "terminal" as it typically runs in a terminal window)"

Sign in to comment.

More Answers (1)

KSSV
KSSV on 27 May 2017
i1 = imread(manual_images(k).name) ;
  1 Comment
KALYAN ACHARJYA
KALYAN ACHARJYA on 27 May 2017
Thank for your reply, Still, shows error as following
Error in drive_seg_result (line 58)
i1=imread(manual_images(k).name);

Sign in to comment.

Categories

Find more on Loops and Conditional Statements 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!