I have a text file where each line is a data point in the form:
[ -495.01172, -158.35966, 2705.0 ]
[ -489.15576, -127.229675, 2673.0 ]
[ -487.6918, -97.679855, 2665.0 ]
[ -487.32578, -68.4594, 2663.0 ]
[ -485.86182, -39.19415, 2655.0 ]
[ -485.3128, -10.12311, 2652.0 ]
[ -484.03183, 18.853745, 2645.0 ]
[ -482.75082, 47.677364, 2638.0 ]
[ -481.6528, 76.37677, 2632.0 ]
[ -481.6528, 105.184616, 2632.0 ]
...
Each line represents [x,y,z]
. I need to 3D plot these, but I am getting errors. Below is what I've tried along with the resulting error.
data = Import[
"C:\\Users\\user\\Desktop\\out.txt", "text"]
data2 = List[
StringReplace[
data, {"[" -> "{", "]" -> "}", "\n" -> ",", " " -> ""}]]
ListPointPlot3D[data2]
The first two lines run successfully. The last line returns:
...{1161.5232,-887.44867,1677.0}} must be a valid array or a list of valid arrays >>