All combinations from vectors
My colleague walked into my office with a MATLAB question, a regular pasttime for us here at the MathWorks. He wanted to take every combination of one value from each of three distinct vectors. Now, this could be done easily with some nested for loops, but that really does violate the spirit in which such challenges are issued. I did not know of a function in MATLAB that did that, but I figured someone had invented that wheel before, so off to the File Exchange. A few minutes later I remembered the difference between combinations and permutations and had found two great new picks for this week.
Permutations: A great little file, with published documentation, that will find all permutations with lots of options.
Combinations: Another great little utility that answered my colleague’s challenge. It was nice to see that the author, Jos, followed up on comments from reviewers and made some good enhancements to the file.
댓글
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.