Dynamically generating a set of combinations for elements of a vector
1 view (last 30 days)
Show older comments
Hi there,
I have to dynamically define a vector m = (m_x, m_y, m_z) where each of the 3 elements in m can take values between -Nm and Nm creating a set of (2Nm +1)^2 combinations. Can anyone help me define all combinations of the possible values of m for a given value of Nm?
Thank you!!
0 Comments
Answers (1)
Walter Roberson
on 18 Oct 2016
The functions I show there are for 6 sets, but otherwise the code is generalized -- notice there that the first thing I do is toss the values to select from into a cell array, so you can follow on from after that step if your values are already in a cell array.
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!