2
$\begingroup$

I have the following list:

list = {V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, \
z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, \
V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, \
z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, \
V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, \
z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, \
V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, V, z, {0.0771386,
  1.02063*10^-7}, {0.114181, 1.02467*10^-7}}

I would like to only retain the numeric values:

{{0.0771386, 1.02063*10^-7}, {0.114181, 1.02467*10^-7}}

How can I do it?

$\endgroup$
6
$\begingroup$

Try

   Cases[list, {__?NumericQ}]

Mathematica graphics

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks a lot ! This worked ! $\endgroup$ – james Mar 31 at 10:38
3
$\begingroup$

Or

DeleteCases[list, _?AtomQ]

or

Select[list, MatchQ[#, _List] &]

.

(*   {{0.0771386, 1.02063*10^-7}, {0.114181, 1.02467*10^-7}}   *)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Nice, also works ! $\endgroup$ – james Mar 31 at 11:28

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.