MATLAB: Get the column number of the false values in a logical output

columnfalseindexindexinglogical?MATLAB

I am trying to get the column numebr of the false values in a logical output called 'index'. My code is below
N = 50;
A = 1:N;
B = 1:41;
index = ismember(A,B);
C = index(index == 0);

Best Answer

You can use the find function:
N = 50;
A = 1:N;
B = 1:41;
index = ismember(A,B);
[row,col] = find(~index);
disp(col)
42 43 44 45 46 47 48 49 50