selection of particular rows from a matrix?

1 次查看(过去 30 天)
I would like to select rows from a matrix in a particular pattern as: row nos 1,2,3,5,6,7,9,10,11,13 and so on. Please help me in coding the loop.

回答(1 个)

michio
michio 2016-10-23
编辑:michio 2016-10-23
ismember function could do the work with 'rows' option.
Please check the example code with 'rows' option on the doc page.
  1 个评论
michio
michio 2016-10-24
Very simple sample code follows.
A = [1,2,3; 2,3,1; 3,1,2];
B = [2,3,1];
idx = ismember(A,B,'rows')
A(idx,:)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by