How to mask cells of certain values?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rightia Rollmann
am 23 Sep. 2018
Bearbeitet: Rightia Rollmann
am 24 Sep. 2018
The following works well:
A = [1 2 3 4 5];
A > 2
0 0 1 1 1
But, how can i mask A==1 and A ==3, so getting the following result (for example putting the values that are to be masked in a vector):
mask_array = [1 2];
A ~= mask_array
0 1 0 1 1
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 23 Sep. 2018
Bearbeitet: Image Analyst
am 23 Sep. 2018
Try this:
mask = (A == 1) | (A == 3) % 1 for either 1 or 3
Or maybe you mean
mask = (A == 1) | (A >= 3) % 1 for 1 or anything 3 or more.
1 Kommentar
Rightia Rollmann
am 24 Sep. 2018
Bearbeitet: Rightia Rollmann
am 24 Sep. 2018
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Author Block Masks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!