Assum I have a matrix of logicals MxN
:
mask=[0 0 0 0 0;
0 1 1 0 0;
0 1 1 0 0;
0 0 0 0 0;
0 0 0 0 0];
in this case M=N=5.
A second matrix A
with the sizes 'MxNx3' (RGB image). I want to pass a function values of A
with respect to the mask. For example all values that are not part of the mask:
foo(A(~mask));
Sure this line of code is useless since mask
gives me indices of only one of the RGB colors.
- what is the correct way to do this?
- Can I get away with a one line?