I am trying to create a list list2
removing elements from a list list
.
The structure of list
is a mix of numbers and strings, for example:
mata = {"mc011", "mc021"};
matb = {"mc011", "mc021"};
list=Flatten[Table[ToString[mata[[i]] <> "-" <> matb[[j]] <> "-"<>
ToString[Abs[eigvaltot[i, j, 0.5]]]], {i, 1, 2}, {j, 1, 2}], 1]
with the output
{mc011-mc011-{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
mc011-mc012-{1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.707107,
0.707107,0.707107, 0.707107, 0.707107, 0.707107, 0.707107,
0.707107},
mc021-mc011-{1, 1, 1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
0.5, 0.5, 0.5},
mc021-mc021-{1, 1, 1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
0.5, 0.5, 0.5}}
and I need to eliminate the elements that have the first $6$ numeric values $=1$, in the way
list2={mc011-mc011-{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
mc011-mc012-{1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.707107,
0.707107,0.707107, 0.707107, 0.707107, 0.707107, 0.707107,
0.707107}}
Until now I was able to do it in a list without the strings using DeleteCases
DeleteCases[testb, {x_, y_, z_, i_, j_, k_, l_, n_, o_, p_, q_, r_, s_,
t_, u_,v_} /; (z == 1 && i == 1 && j == 1 && k == 1 && l == 1 &&
n == 1 && o != 1 && p != 1 && q != 1 && r != 1 && s != 1 && t != 1 &&
u != 1 && v != 1)]
Here testb
is a sample list that I made to try "DelateCases". Now the problem is that when I try to include the string it does not work
list2=DeleteCases[list, {x_, y_, {z_, i_, j_, k_, l_, n_, o_, p_, q_, r_,
s_, t_, u_, v_, w_, a_}} /; (z == 1 && i == 1 && j == 1 && k == 1 &&
l == 1 && n == 1)]
My list list
is huge so, I need to automatize the process. Do you know a wise way to perform this procedure?. Thanks in advance.
mc*
are symbols not string. You might need to post your raw data format which is more helpful. $\endgroup$ – L.Yu May 23 '19 at 13:50list
was created. The first elements are part of another list with names $\endgroup$ – mors May 23 '19 at 14:05eigvaltot
. Doing so will greatly increase your chances of getting usable answers. $\endgroup$ – Roman May 23 '19 at 15:20