How can I check if a condition holds?

3 visualizzazioni (ultimi 30 giorni)
Stef
Stef il 5 Giu 2018
Modificato: Image Analyst il 5 Giu 2018
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?

Risposte (1)

Image Analyst
Image Analyst il 5 Giu 2018
Modificato: Image Analyst il 5 Giu 2018
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?

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by