How can I assign integers from 1 to 40 randomly to six different variables such that they don't repeat in any of the arrays and no number gets left out?
The array size of each variable should be random as well.
An approach I have considered is using
v = randperm(40);
a = randi([1,40])
Sat1 = v(1:a)
b = randi([a,40])
Sat2 = v(a+1:b)
c = randi([b,40])
Sat3 = v(b+1:c)
d = randi([c,40])
Sat4 = v(c+1:d)
e = randi([d,40])
Sat5 = v(d+1:e)
f = randi([e,40])
Sat6 = v(e+1:f)
But then the problem is in some generations will lead to empty arrays or even unassigned integers! Any ideas?
Best Answer