Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7477 > unrolled thread
| Started by | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| First post | 2011-12-30 12:12 +0000 |
| Last post | 2011-12-30 12:12 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: DeleteCases Bill Rowe <readnews@sbcglobal.net> - 2011-12-30 12:12 +0000
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Date | 2011-12-30 12:12 +0000 |
| Subject | Re: DeleteCases |
| Message-ID | <jdk9qv$8cc$1@smc.vnet.net> |
On 12/29/11 at 2:54 AM, umberto.prisco@unina.it (umberto) wrote:
>I have tables of this type:
>{{{{0.912546, 0.1081}, -0.0206463}, {{0.186044, 0.835368},
>-0.0214121}, {{0.0841709, -0.676585}, 1.59241}}, {{{-0.976965,
>-0.339164, -0.210989}, 2.52712}, {{0.13978, -0.995106, 0.756386},
>1.09894}, {{-0.313147, -0.432759, 0.207548}, 1.53836}}}
>I'd like to delete from the table elements of the type: {{x, x,
>...., x}, y} when y is not in the interval [-1, 1]. I was trying
>with DeleteCases, but with no success. Could you, please, help me.
>best regards Umberto
In[11]:= Cases[data, {_, _?(IntervalMemberQ[
Interval@{-1, 1}, #] &)}, \[Infinity]]
Out[11]= {{0.912546, 0.1081}, {{0.912546, 0.1081}, -0.0206463},
{0.186044, 0.835368}, {{0.186044, 0.835368}, -0.0214121},
{0.0841709, -0.676585}}
or if you prefer
DeleteCases[data, {_, _?(!IntervalMemberQ[
Interval@{-1, 1}, #] &)}, \[Infinity]]
will do the same thing
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web