comarison of N images
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2018-5-8
编辑:Stephen23
2018-5-8
@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.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!