Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Combinations, iterations, indices and file names
Replies:
7
Last Post:
Sep 19, 2009 9:13 PM




Combinations, iterations, indices and file names
Posted:
Sep 18, 2009 10:04 PM


I have many, but I'll restrict this example to 5 images that I want to compare each to each other. Simple combinatorics yields 10 pairings. 5!/2!*(52)! If I put the vector 1:5 in the "N" argument for nchoosek, I get the numerical values for each pairing  1 with 2; 1 with 3; 1 with 4;... 4 with 5  in the cells of a matrix. The five images I want to compare are 64x128 cells each. While I have the freedom to name these files anything I wish, there are no file names that I can know of that allow me to interate through them to automate (loop through) the comparisons. to try to solve that problem, I put them all in one 64x640 cell matrix. I'll call it Pat. Then I could compare Pat(1:64,1:128) with Pat(1:64,129:256) for the 1 with 2 comparison, and so on. Unfortunately, I still have a naming/iteration problem. The next comparison, (1 with 3), is Pat(1:64,1:128) with Pat(1:64,257:384). The second image gets iterated, but the first doesn't. ANd even if I am willing to put all of the output into one file like the input is, I still have iteration "issues".
To generalize the problem: I want to loop through all the the combinations of n matrices taken two at a time.
Thanks in advance.
Paul



