Another approach, though slower, makes use of the new function DeleteElements
from v13.1
It is handy if you
- Want to preserve the dimensions of the original list (
list
)
- Delete specific elements which may or may not repeat
- Elements to delete are not in order
list={{{1,1,1,1},{28.9063,0.861155}},{{1,1,1,11},{32.2188,0.512393}},{{1,1,1,21},{29.9063,0.410614}},{{1,1,1,31},{27.4219,0.351969}}};
finalList={{{1,1,1,1},0.861155},{{1,1,1,11},0.512393},{{1,1,1,21},0.410614},{{1,1,1,31},0.351969}};
delete={28.9063,32.2188,29.9063,27.4219}; (* or list[[All,2,1]] *)
deletedList=Map[DeleteElements[#,delete]&,list,2]; (* {{{1,1,1,1},{0.861155`}},{{1,1,1,11},{0.512393`}},{{1,1,1,21},{0.410614`}},{{1,1,1,31},{0.351969`}}} *)
deletedList === finalList (* False*)
To get your desired output you can adjust the output
gar = Transpose@deletedList;
bar = Flatten[#[[-1]]] &@gar;
adjustedList = Transpose[{gar[[1]], bar}]; (*{{{1,1,1,1},0.861155},{{1,1,1,11},0.512393},{{1,1,1,21},0.410614},{{1,1,1,31},0.351969}}*)
adjustedList === finalList (* True*)