I have a large list with varying constituent parts. Some of these are like this:
i.e. graphlist[[34]]
{{{33, 0.0115084}}, {{33, 0.00539003}}, {{33, 0.0158185}},
{{33, 0.0136278}}, {{33, 0.00756737}}, {{33, 0.0017506}},
{{33, 0.038599}}, {{33, 0.00538894}}, {{33, 0.00656522}},
{{33, 0.00310004}}, {{33, 0.00151645}}, {{33, 7.75*10^-7}},
{{33, 0.00205609}}, {{33, 0.00125328}}}
Whereas others are like this:
graphlist[[1]]
{{}, {{0, 0.00342769}}, {{0, 0.00503465}}, {},
{{0, 0.000187}}, {}, {}, {}, {}, {}, {}, {}, {}, {}}
Because they are all part of a long list, I'm trying to find a command that can do the following. On a list without any null values, I am running this command to get the second part:
graphlist[[34]][[All, 1]][[All, 2]]
> {0.0115084, 0.00539003, 0.0158185, 0.0136278, 0.00756737, 0.0017506,
> 0.038599, 0.00538894, 0.00656522, 0.00310004, 0.00151645,
> 7.75*10^-7, 0.00205609, 0.00125328}
But if I run a similar command on the list with nulls, the error message: "Part::partw: Part 1 of {} does not exist. >>" ensues. My goal is to similarly get output that would look like this:
{0,0.00342769,0.00503465,0,0.000187,0,0,0,0,0,0,0,0,0}
Is there a way to construct a command that simply returns a 'zero' value for empty brackets? Thanks in advance.