How can I get MATLAB to select a random variable from a set of variables?
Show older comments
I'm trying to write a program that generates a random combination based on variables. For example, the first set has variables A through D and a second set has variables E through H. I want to generate combinations from both sets like AE, DH, CF, etc.
Accepted Answer
More Answers (1)
Walter Roberson
on 16 Oct 2016
0 votes
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.
Categories
Find more on Random Number Generation 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!