SeedRandom[1];
tbl = Join[RandomInteger[5, {2, 2}],
RandomInteger[5, {3, 4}],
RandomInteger[5, {2, 3}]]
{{4, 2}, {4, 0},
{1, 0, 0, 2}, {0, 0, 3, 5}, {2, 0, 3, 4},
{4, 1, 3}, {3, 4, 1}}
You can use SplitBy
SplitBy[tbl, Length]
{{{4, 2}, {4, 0}},
{{1, 0, 0, 2}, {0, 0, 3, 5}, {2, 0, 3, 4}},
{{4, 1,3}, {3, 4, 1}}}
If the input is not already sorted by length as in
SeedRandom[1];
tbl2 = RandomSample[tbl]
{{3, 4, 1}, {2, 0, 3, 4}, {1, 0, 0, 2}, {4, 1, 3},
{4, 2}, {0, 0, 3, 5}, {4, 0}}
you can sort it before applying SplitBy
SplitBy[SortBy[{Length}]@tbl2, Length]
{{{4, 2}, {4, 0}},
{{3, 4, 1}, {4, 1, 3}},
{{2, 0, 3, 4}, {1, 0, 0, 2}, {0, 0, 3, 5}}}
If the output need not be sorted, you can also use GatherBy
:
GatherBy[tbl2, Length]
{{{3, 4, 1}, {4, 1, 3}},
{{2, 0, 3, 4}, {1, 0, 0, 2}, {0, 0, 3, 5}},
{{4, 2}, {4, 0}}}
Alternatively, you can use GroupBy
Values @ GroupBy[Length] @ tbl2
{{{3, 4, 1}, {4, 1, 3}},
{{2, 0, 3, 4}, {1, 0, 0, 2}, {0, 0, 3, 5}},
{{4, 2}, {4, 0}}}