3
$\begingroup$

I have a list which contains some matrices. Some of the matrices contain Overflow[] elements. I want to delete these matrices.

list = {{{1, 2}, {1, 2}},
 {{1, 2}, {Overflow[], Overflow[]}, {Overflow[], Overflow[]}}, 
 {{Overflow[], Overflow[], Overflow[]}, {Overflow[], Overflow[], Overflow[]}, 
  {Overflow[], Overflow[], Overflow[]}}}

The result should be only {{1, 2}, {1, 2}}.

$\endgroup$
  • 2
    $\begingroup$ Select[ list, Not[ MemberQ[ #, Overflow[], Infinity] ] & ] $\endgroup$ – LouisB Sep 19 '19 at 2:54
4
$\begingroup$
   DeleteCases[list, _?(MemberQ[Flatten[#], Overflow[]] &)]

Mathematica graphics

| improve this answer | |
$\endgroup$
2
$\begingroup$
Cases[_?(FreeQ[Overflow[]])] @ list

{{{1, 2}, {1, 2}}}

Also

DeleteCases[_?(Not @* FreeQ[Overflow[]])] @ list

{{{1, 2}, {1, 2}}}

DeleteCases[Except @ _?(FreeQ[Overflow[]])] @ list

{{{1, 2}, {1, 2}}}

| improve this answer | |
$\endgroup$
0
$\begingroup$
Pick[list, FreeQ[#, Overflow[]] & /@ list]

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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