Borrar filtros
Borrar filtros

dear all:I have a 6* 3 matrix. I wanna choose 4rows randomly. how can I selecete all array in a rows randomly without replacement?

2 visualizaciones (últimos 30 días)
for example:
A=[1 2 3;2 3 5;6 4 1;8 6 0;2 4 1;1 4 7;8 4 2];
and the answer is:
[1 2 3;6 4 1;8 6 0;8 4 2];

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 27 de Jul. de 2016
Editada: Azzi Abdelmalek el 27 de Jul. de 2016
A=[1 2 3;2 3 5;6 4 1;8 6 0;2 4 1;1 4 7;8 4 2]
B=A(randperm(6,4),:)
  4 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps 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