Info

This question is closed. Reopen it to edit or answer.

Creating random numbers with restrictions

1 view (last 30 days)
Alina Kruger
Alina Kruger on 12 Nov 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi!
I am trying to create arrays of three elements that would represent variable inter-trial durations (for 50 trials). Specifically, I need 3 durations between 250 and 750 msec with following restrictions:
1) the three durations should together sum to 1500 msec
2) the three duration should be of length that is a multiple of 50 msec (i.e. 200, 250, 300, 350, 400, 450, 500, 550, 600 msec)
3) no two numbers should be the same for the same trial (e.g. 400, 400, 400 or 300, 300, 600 should not be possible)
Basically, I would like to get a 50 x 3 matrix in the end, something like:
300 350 550
400 500 300 etc.
I am really struggling with it and I would appreciate any help.
Thanks!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!