I would like to parse every sublist of a nested list and select only those elements that have a certain length, i.e., smaller than 10 elements while maintaining the list structure. Is there any quick trick that makes it work ?
Matrix = {
{
{
{O1,2,22,24,28,14,D1},
{O1,1,21,23,27,13,D1},
{O1,2,22,24,28,27,13,D1},
{O1,2,22,24,28,14,13,D1},
{O1,2,22,24,23,27,13,D1},
{O1,2,22,21,23,27,13,D1},
{O1,2,1,21,23,27,13,D1},
{O1,1,21,23,27,28,14,D1},
{O1,1,21,23,27,13,14,D1},
{O1,1,21,23,24,28,14,D1},
{O1,1,21,22,24,28,14,D1},
{O1,1,2,22,24,28,14,D1},
{O1,2,22,24,28,27,13,14,D1},
{O1,2,22,24,23,27,28,14,D1},
{O1,1,2,22,21,23,25,9,10,26,24,28,18,17,27,13,14,D1},
{O1,1,2,22,21,23,25,9,10,26,24,28,16,15,27,13,14,D1},
{O1,1,2,22,21,23,25,7,8,26,24,28,20,19,27,13,14,D1},
{O1,1,2,22,21,23,25,7,8,26,24,28,18,PoP2,17,27,13,D1},
{O1,1,2,22,21,23,25,7,8,26,24,28,18,17,27,13,14,D1},
{O1,1,2,22,21,23,25,7,8,26,24,28,16,15,27,13,14,D1},
{O1,1,2,22,21,23,5,PoP1,6,24,28,18,PoP2,17,27,13,14,D1},
{O1,2,1,21,22,24,26,12,11,25,23,27,17,PoP2,18,28,14,13,D1},
{O1,2,1,21,22,24,26,10,9,25,23,27,17,PoP2,18,28,14,13,D1},
{O1,2,1,21,22,24,26,8,7,25,23,27,17,PoP2,18,28,14,13,D1},
{O1,1,2,22,21,23,25,11,12,26,24,28,18,PoP2,17,27,13,14,D1},
{O1,1,2,22,21,23,25,9,10,26,24,28,18,PoP2,17,27,13,14,D1},
{O1,1,2,22,21,23,25,7,8,26,24,28,18,PoP2,17,27,13,14,D1}
}
}
}
the result needs to be :
{
{
{
{O1,2,22,24,28,14,D1},
{O1,1,21,23,27,13,D1},
{O1,2,22,24,28,27,13,D1},
{O1,2,22,24,28,14,13,D1},
{O1,2,22,24,23,27,13,D1},
{O1,2,22,21,23,27,13,D1},
{O1,2,1,21,23,27,13,D1},
{O1,1,21,23,27,28,14,D1},
{O1,1,21,23,27,13,14,D1},
{O1,1,21,23,24,28,14,D1},
{O1,1,21,22,24,28,14,D1},
{O1,1,2,22,24,28,14,D1},
{O1,2,22,24,28,27,13,14,D1},
{O1,2,22,24,23,27,28,14,D1}
}
}
}
Appreciated any help,