Message Boards Message Boards

How do I combine 3 lists into one 3d list?

Posted 10 years ago

I am wondering how to combine lists as in the following description. Here is my code.

(* Create empty lists *) xlist={}; ylist={}; zlist={};

(* Take inputs for ECEF *) (Label[startinput];x = Input["What is the x coordinate?"]; y = Input["What is the y coordinate?"]; z = Input["What is the z coordinate?"]; AppendTo [xlist, x] AppendTo [ylist, y] AppendTo [zlist, z] (Label[errorcontrol]; again=InputString["Enter more coords? Y for yes, N for no"]; If [again=="Y", Print["Okay!"];Goto[startinput]]; If [again!="N", Print["Sorry, this is an invalid input here!"];Goto[errorcontrol]]; If [again=="N", Print["Okay."]]));

(* Debugging *) Print[xlist] Print[ylist] Print[zlist] Print[x] Print[y] Print[z]

(* Put in Coordinate Form *) GeoPositionXYZ[{x, y, z}, "ITRF00"];

(* Convert to LLA *) GeoPosition[%]

(* Display Map *) GeoGraphics[GeoMarker[GeoPosition[%]],GeoRange -> "World", GeoProjection -> "Robinson"]

(* Display 3D Plot *) ListPointPlot3D[{{x, y, z}}]

I need to know how to combine listx (the list of x coords) and listy (the list of y coords) and listz (the list of z coords) into one list of 3D coords in form {{x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3} etc...} Thank you.

POSTED BY: Nathan Lundholm
5 Replies
Transpose[xlist,ylist,zlist]
POSTED BY: Gianluca Gorni
Posted 10 years ago

list=Transpose[xlist,ylist,zlist] returns this error: Transpose::nonopt: Options expected (instead of {333333,77777}) beyond position 2 in Transpose[{111111,55555},{222222,66666},{333333,77777}]. An option must be a rule or a list of rules. >>

POSTED BY: Nathan Lundholm

Sorry,

Transpose[{xlist,ylist,zlist}]
POSTED BY: Gianluca Gorni
Posted 10 years ago

Thanks. Now that I have a list of 3 dimensional points, how do I find out how many points are in the list? I need to write a for loop that goes through them all, converts them all to latitude/longitude, and puts them all on the same 2d map.

POSTED BY: Nathan Lundholm
Length[myList]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract