comarison of N images
1 view (last 30 days)
Show older comments
suppose I have N images in my single folder let say n1,n2,n3,n4,n5,n6....(images no) i want to compare d images like this n1 and n2-o/p1 n2 and n3-o/p2 n3 and n4-o/p3 n4and n5 - o/p4 so on... al the output store in one location my for loop is not working plzz help me out thnx
6 Comments
Stephen23
on 8 May 2018
Edited: Stephen23
on 8 May 2018
@praveen rai: your code seems to have several bugs. For example size(data) returns a 1x2 vector [1,6], which you then use with colon operator as an input to for:
1:size_data
According to the colon help only the first element of non-scalar inputs is used, so your code is equivalent to
1:size_data(1)
which is equivalent to
1:1
which is equivalent to
1
So your loop iterates just once. Also your define a variable i before the loop: this will get ignored because you redefine i to be the loop iterator. Then inside the loop you increment i, but this will be discarded by the for on the next loop iteration.
The if input condition data(i) < data(i+1:end)) will always be true for the sample data. For values not in sequence this might not be true. In any case, regardless of how many times it might be true your code discards all temp allocations except for the very last one, because you did not use any operation to add/store all of the temp values into one value/array.
It is not clear what you are actually trying to do, so I cannot suggest any changes to your code.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!