Matlab - select all rows starting with a particular number

别说谁变了你拦得住时间么 提交于 2020-01-15 07:08:10

问题


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:


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,:); 


来源:https://stackoverflow.com/questions/5561007/matlab-select-all-rows-starting-with-a-particular-number

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!