consider a list as follows:
list = {{{{{{{1, 1}, {1, 1}}, 0.}, {{{1, 1}, {1, 2}},
29.7586}}, {{{{1, 1}, {2, 1}}, 0.165637}, {{{1, 1}, {2, 2}},
37.2042}}}, {{{{{1, 2}, {1, 1}}, 29.7586}, {{{1, 2}, {1, 2}},
0.}}, {{{{1, 2}, {2, 1}}, 29.7492}, {{{1, 2}, {2, 2}},
32.2175}}}}, {{{{{{2, 1}, {1, 1}}, 0.165637}, {{{2, 1}, {1, 2}},
29.7492}}, {{{{2, 1}, {2, 1}}, 0.}, {{{2, 1}, {2, 2}},
37.2055}}}, {{{{{2, 2}, {1, 1}}, 37.2042}, {{{2, 2}, {1, 2}},
32.2175}}, {{{{2, 2}, {2, 1}}, 37.2055}, {{{2, 2}, {2, 2}},
0.}}}}};
I want to delete the elements {{{1, 1}, {1, 1}}, 0.}, {{{1, 2}, {1, 2}}, 0.},{{{2, 1}, {2, 1}}, 0.} and {{{2, 2}, {2, 2}}, 0.}
How can I do this?
Edit 1
Let me breakdown the problem. Consider,
val = {{0., 29.7586, 0.165637, 37.2042}, {29.7586, 0., 29.7492,
32.2175}, {0.165637, 29.7492, 0., 37.2055}, {37.2042, 32.2175,
37.2055, 0.}};
coordpair =
Table[{{i, j}, {k, l}}, {i, 1, 2, 1}, {j, 1, 2, 1}, {k, 1, 2,
1}, {l, 1, 2, 1}];
I have constructed the list
by combining val
and coordpair
. Is it possible to delete the cases in coordpair
where {i, j} == {k, l}
?
Delete[list, Position[list, Alternatives @@ del]]
would be relevant? (del
is a list of the items to delete.) $\endgroup$ – user42582 Jan 24 '18 at 10:34