Suppose you have the following lists
ans = {a1, a2, a3, a4, a5, a6};
bns = {b1, b2, b3, b4, b5, b6, b7, b8};
And the following output.
(* Out[69]= {26., {a1 -> 0., a2 -> 0., a3 -> 0., a4 -> 0., a5 -> 0.,
a6 -> 1., b1 -> 0., b2 -> 0., b3 -> 0., b4 -> 0., b5 -> 1.,
b6 -> 0., b7 -> 0., b8 -> 1.}} *)
How do I automatically create a list so that I have list of a and bs that were given the output of 1.
is this case,
{a6, b5, b8}
And if you have the following lists,
as = {3, 1, 4, 5, 5, 8};
an = {100, 50, 100, 150, 50, 100};
ans = {a1, a2, a3, a4, a5, a6};
bs = {3, 5, 1, 6, 8, 5, 5, 10};
bn = {100, 200, 150, 50, 150, 200, 50, 150};
bns = {b1, b2, b3, b4, b5, b6, b7, b8};
how will I populate a list to have the following structure based on that output from above?
{a6, 100, 8} (*a6 from "ans list", 100 from "an list" corresponding to a6, and 8 from "as list" also corresponding to a6 position.*)
{b5, 150, 8, b8, 150, 10}
I need to learn to do it so that I can apply it to much longer list.