select 2 rows in a (n,m) matrix

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일

0 개 추천

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일

0 개 추천

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.

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

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2018년 1월 4일

댓글:

Rik
2018년 1월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by