Say I have a matrix A, and I want to construct a matrix B that contains all rows of B that start with a particular number. How? Thanks
1 Answer
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,:); 2 Comments
Yebo
No, I meant rows that contain the particular number. For example, if A=[1 2; 3 4; 1 7] and we look for all rows starting with 1, I'd like to get [1 2; 1 7]
user492238
I merged the other answer into that one.