select 2 rows in a (n,m) matrix

1 次查看(过去 30 天)
jaah navi
jaah navi 2018-1-4
评论: Rik 2018-1-5
what command can be used to select 2 rows in a matrix(10,10),3 rows in a matrix(10,10),4 rows in a matrix (10,10)

回答(2 个)

KL
KL 2018-1-4
编辑:KL 2018-1-4
I suppose you want to randomly sample 1,2 or 3 rows from your matrix.
A = rand(10); % example
noRows = 1;
A_sample = A(randperm(size(A,1),noRows),:);

Torsten
Torsten 2018-1-4
rowi = A(i,:);
selects the i'th row from the matrix A.
Does this help ?
Best wishes
Torsten.
  1 个评论
Rik
Rik 2018-1-5
This is the solution they should be looking for. And knowing that i can be a vector.

请先登录,再进行评论。

类别

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