Conditional equation X1=X(y==1) ?

2 次查看(过去 30 天)
I have a matrix X and a column vector y. When I write something like X1=X(y==1), I only get the numbers from the first column of X. How to get numbers from all others columns when y==1 ?

采纳的回答

Fangjun Jiang
Fangjun Jiang 2017-7-13
X1=X(y==1,:)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by