Concise way to compare/find multiple values
48 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
If I have a matrix of integers called A and want to find the mask corresponding to values 1 and 7, I currently do this:
mask = (A == 1 | A == 7);
But is there a conciser way of doing this? Something like A == [1 7]. If I have many lookups I'd need to use a for loop or maybe bsxfun. It feels like there should be some simple way I'm missing.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Author Block Masks finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!