Home How to get combinations of vectors?
Reply: 0

How to get combinations of vectors?

Sathish Krishnan
1#
Sathish Krishnan Published in 2018-01-12 16:28:01Z

This question already has an answer here:

  • How to generate all pairs from two vectors in MATLAB using vectorised code? 7 answers
  • Generate a matrix containing all combinations of elements taken from n vectors 4 answers

I have two configurations, lets say 0 0 0 and 1 1 1. I would like to get all the intermediate combinations using Matlab:

0 0 0
1 0 0
0 1 0
0 0 1
1 1 0
1 0 1
0 1 1
1 1 1

Though it appears like a simple requirement, I was not able to automate this procedure. The array size is always 3. I can write the combinations manually, but I am looking for the logic (function) to achieve this.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310894 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO