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

13 次查看(过去 30 天)
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);

采纳的回答

Rik
Rik 2020-12-9
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by