How do I pick all the elements of a table, X number of times, without replacement?

7 visualizaciones (últimos 30 días)
I have a table consisting of 50 elements - it is a 50 x 2 table wherein each row represents a point location (in terms of X and Y coordinates). How do I pick these 50 points, 20 different times, in a random order? To make myself more clear, I need each of these 50 different points (the X,Y coordinate pairs) picked 20 different times, in a random manner.
Example: The order of the points appearing could be:
7,31,25,43,7,42,15,...... (each number represents the corresponding X and Y values of the concerned point)
As I have shown, the same point might appear close to itself without all the other points being picked out. I cannot seem to think of an efficient construct to implement what I need. The best I can think of is to pick all the 50 points in some order and then once all the 50 points have been picked, start over again and pick them. But this doesn't completely meet my requirements, as I would like the points to appear close to each other occasionally too (based on MATLAB's random ordering).

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Mayo de 2017
T = repmat(1:50,1,20)
Order = reshape(randperm(length(T)), [], 20)
Now each experiment is a row in Order

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by