Select random numbers from a matrix

12 visualizaciones (últimos 30 días)
Pei Jia
Pei Jia el 16 de Dic. de 2017
Comentada: Abdelrahman Mohamed el 4 de Mzo. de 2023
I want to select 100 random numbers from a certain column of a matrix. What should I do?

Respuestas (1)

Image Analyst
Image Analyst el 16 de Dic. de 2017
Try this:
y = rand(1000, 3); % Some random data
% Select 100 numbers randomly from column 2:
selected = y(randperm(size(y, 1), 100), 2)
  2 comentarios
Nishant Gupta
Nishant Gupta el 21 de Abr. de 2020
thanks a lot
Abdelrahman Mohamed
Abdelrahman Mohamed el 4 de Mzo. de 2023
thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices 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