cesar
(Antonio de Oliveira)
1
I have a list with sub lists like;
list = {{{-2, 1}, {3, 10}, {2, 8}}, {{2, 3}, {1, 9}, {5, 2}}, {{4, 7}, {3, 6}, {1, 5}}}
I need a code that gives me the value of x for which y is maximum
for each one of the sub lists. So I would obtain:
{3, 1, 4}
Thanks for any help
sghuisman
(Sander Huisman)
2
Multiple ways are possible:
Part[MaximalBy[Last] /@ list, All, 1, 1]
Or:
Part[SortBy[Last] /@ list, All, -1, 1]
cesar
(Antonio de Oliveira)
3
Sander,
This works great…
Thanks a lot