Select random numbers from a matrix

조회 수: 12 (최근 30일)
Pei Jia
Pei Jia 2017년 12월 16일
댓글: Abdelrahman Mohamed 2023년 3월 4일
I want to select 100 random numbers from a certain column of a matrix. What should I do?

답변 (1개)

Image Analyst
Image Analyst 2017년 12월 16일
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
Nishant Gupta
Nishant Gupta 2020년 4월 21일
thanks a lot
Abdelrahman Mohamed
Abdelrahman Mohamed 2023년 3월 4일
thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by