Matlab - 选择以特定数字开头的所有行 [英] Matlab - select all rows starting with a particular number

查看:533
本文介绍了Matlab - 选择以特定数字开头的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个矩阵A,我想构建一个矩阵B,它包含以特定数字开头的所有B行。怎么样?
谢谢

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

推荐答案

选择B的所有行为A,其中B的第一列具有值n:

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

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

与此相反,以下选择B的所有行为A,从行开始index n:

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

A = B(n:end,:); 

这篇关于Matlab - 选择以特定数字开头的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆