aliteimor
(Alex Teymouri)
1
Hi,
I have four lists like this :
How do I have the final lists for list A, list B, list C, and list D as follow:
listAfinal = {28, 35, 40, 43, 44};
listBfinal = {20, 28, 35, 40, 43};
listCfinal = {18, 20, 28, 35, 40};
listDfinal = {13, 18, 20, 28, 35};
Hi Alex, try:
{listAfinal, listBfinal, listCfinal, listDfinal} = #[[4 ;; 8]] & /@ {listA, listB, listC, listD};
or
{listAfinal, listBfinal, listCfinal, listDfinal} = {listA, listB, listC, listD}[[All, 4 ;; 8]];
aliteimor
(Alex Teymouri)
3
Thank you so much, Henrik.
Is there any simple command for extracting list B, list C, and list D from list A?
My main list A has about 14000 elements.
Alex, is it simply this you want?
listB = Prepend[listA, ""];
listC = Prepend[listB, ""];
listD = Prepend[listC, ""];
Does the code I attached help?
It should with a large spreadsheet.
Hi Alex,
If the spreadsheet is the source of the data then you can generate the final lists like this. I created the attached AlexData.xlsx for testing.
{listAfinal, listBfinal, listCfinal, listDfinal} =
Import["~/Downloads/AlexData.xlsx", {"Data", 1, 5 ;; 9, 2 ;; 5}] // Transpose // Reverse;
{listAfinal, listBfinal, listCfinal, listDfinal} // Column
(*
{28.,35.,40.,43.,44.}
{20.,28.,35.,40.,43.}
{18.,20.,28.,35.,40.}
{13.,18.,20.,28.,35.}
*)
AlexData.xlsx (8.65 KB)
aliteimor
(Alex Teymouri)
7
Thank you so much, Henrik, Rohit and John.
You are great men.