开发者

Matlab - select all rows starting with a particular number

开发者 https://www.devze.com 2023-02-22 03:11 出处:网络
Say I have a mat开发者_JAVA技巧rix A, and I want to construct a matrix B that contains all rows of B that start with a particular number. How?

Say I have a mat开发者_JAVA技巧rix A, and I want to construct a matrix B that contains all rows of B that start with a particular number. How? Thanks


Select all rows of B into A, where the first colum of B has value n:

A = B(B(:,1) == n,:); 

In contrast to that, the following selects all rows of B into A, starting from row index n:

A = B(n:end,:); 
0

精彩评论

暂无评论...
验证码 换一张
取 消