Select random numbers from a matrix

12 vues (au cours des 30 derniers jours)
Pei Jia
Pei Jia le 16 Déc 2017
I want to select 100 random numbers from a certain column of a matrix. What should I do?
  1 commentaire
James Tursa
James Tursa le 16 Déc 2017
Provide a short example.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 16 Déc 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 commentaires
Nishant Gupta
Nishant Gupta le 21 Avr 2020
thanks a lot
Abdelrahman Mohamed
Abdelrahman Mohamed le 4 Mar 2023
thanks

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by