Skip to main content
added 80 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

My favorite being a slight variation of @Lou's own solution

Transpose[{data[[;;, 1, 1]], data[[;;, -1, -1]]}]

you can also use

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]
(* version 9 only -- does not work in version 10 -- thanks: Simon Woods *)

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

My favorite being a slight variation of @Lou's own solution

Transpose[{data[[;;, 1, 1]], data[[;;, -1, -1]]}]

you can also use

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

My favorite being a slight variation of @Lou's own solution

Transpose[{data[[;;, 1, 1]], data[[;;, -1, -1]]}]

you can also use

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]
(* version 9 only -- does not work in version 10 -- thanks: Simon Woods *)

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

added 142 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

My favorite being a slight variation of @Lou's own solution

Transpose[{data[[;;, 1, 1]], data[[;;, -1, -1]]}]

you can also use

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

My favorite being a slight variation of @Lou's own solution

Transpose[{data[[;;, 1, 1]], data[[;;, -1, -1]]}]

you can also use

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

added 90 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

enter image description here

Transpose@Rest@Extract[data, {{}, {;; , 1, 1}, {;; , -1, -1}}]

or

ReplacePart[data, p_ :> {data[[p, 1, 1]], data[[p, -1, -1]]}]

or

{First@First@#, Last@Last@#} & /@ data

or

ClearAll[f];
f[{{a_, __}, {__, b_}}] := {a, b}
f /@ data

all give

enter image description here

added 52 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading