Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In a matrix, there are some non-zero elements same as: aA=

enter image description here

Also, there is a list such as:

list = {a, b, c, d, e, f, g, ii, jj, kk};

I want to access to elements of the list which are not in the matrix. (I mean: 'c','d','g','jj') I use Complement to this work:

Complement[aA, list]

But Complement doesn't work.

share|improve this question

1 Answer 1

Flatten the matrix first.

aA = {{a, b, 0}, {e, f, 0}, {ii, 0, kk}};
list = {a, b, c, d, e, f, g, ii, jj, kk};
Complement[list, Flatten@aA]

{c, d, g, jj}

share|improve this answer
I think for my goal, I must write: Complement[list, Flatten@aA] – Bstates Jun 3 '14 at 18:11
@mostafa Oh yes, I didn't read carefully. – mfvonh Jun 3 '14 at 18:14
thank you so much – Bstates Jun 3 '14 at 18:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.