How can I check if a condition holds?

1 次查看(过去 30 天)
I want to find the elements where the following condition holds: 0<x and y=1.
x and y are arrays. How can I find the rows where both conditions hold at the same time?

回答(1 个)

Image Analyst
Image Analyst 2018-6-5
编辑:Image Analyst 2018-6-5
You can say this:
indexes = (x > 0) & (y == 1)
outputArray = inputArray(indexes);
What shape are your x, y, and input array? 1-D vector? 2-D matrix?

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by