Select random numbers from a matrix

I want to select 100 random numbers from a certain column of a matrix. What should I do?

1 件のコメント

James Tursa
James Tursa 2017 年 12 月 16 日
Provide a short example.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2017 年 12 月 16 日

3 投票

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

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2017 年 12 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by