select 2 rows in a (n,m) matrix

2 visualizaciones (últimos 30 días)
jaah navi
jaah navi el 4 de En. de 2018
Comentada: Rik el 5 de En. de 2018
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)

Respuestas (2)

KL
KL el 4 de En. de 2018
Editada: KL el 4 de En. de 2018
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 el 4 de En. de 2018
rowi = A(i,:);
selects the i'th row from the matrix A.
Does this help ?
Best wishes
Torsten.
  1 comentario
Rik
Rik el 5 de En. de 2018
This is the solution they should be looking for. And knowing that i can be a vector.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by