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

조회 수: 11 (최근 30일)
Vance Blake
Vance Blake 2020년 12월 9일
댓글: Vance Blake 2020년 12월 9일
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