0
$\begingroup$

I have a list of data as:

P= { {  {i_1,j_1,{a_n, b_n}} , {i_1,j_2,{a_n,b_n}}  }
,{ {i_2,j_2,{a_n,b_n}} , {i_2,j_2,{a_n,b_n}} } ...
,{ {i_n,j_{n-1},{a_n,b_n}} , {i_n,j_n,{a_n,b_n}} } }.```


How can I remove the **i_1,i_2,...i_n and j_1,j_2...,j_n**.?
$\endgroup$
1
  • 1
    $\begingroup$ 1_ 1 , etc. have incorrect syntax. Do not include underscores in symbol names. $\endgroup$
    – bbgodfrey
    Jan 22 at 22:27
5
$\begingroup$
Clear["Global`*"]

P = {{{i1, j1, {an, bn}}, {i1, j2, {an, bn}}}, {{i2, j2, {an, bn}}, {i2, 
     j2, {an, bn}}}, {{in, j {n - 1}, {an, bn}}, {in, jn, {an, bn}}}};

Assuming that you also want to remove the associated List brackets

Map[Last, P, {2}]

(* {{{an, bn}, {an, bn}}, {{an, bn}, {an, bn}}, {{an, bn}, {an, bn}}} *)

Or

P /. {{_, _, x_}, {_, _, y_}} :> {x, y}

(* {{{an, bn}, {an, bn}}, {{an, bn}, {an, bn}}, {{an, bn}, {an, bn}}} *)
$\endgroup$
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.