回答編集履歴
2
float 変換追加
test
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
float 変換を追加
|
2
|
+
|
3
|
+
```Python
|
4
|
+
|
5
|
+
def to_float_list(tpl):
|
6
|
+
|
7
|
+
return list(map(float, tpl))
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
with open('Marker_200Hz.txt') as f:
|
12
|
+
|
13
|
+
lst = [s.split() for s in f.readlines()]
|
14
|
+
|
15
|
+
lstX = list(map(to_float_list, zip(*[v[2::3] for v in lst])))
|
16
|
+
|
17
|
+
lstY = list(map(to_float_list, zip(*[v[3::3] for v in lst])))
|
18
|
+
|
19
|
+
lstZ = list(map(to_float_list, zip(*[v[4::3] for v in lst])))
|
20
|
+
|
21
|
+
print([lstX, lstY, lstZ])
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
float 変換していないコード
|
28
|
+
|
1
29
|
```Python
|
2
30
|
|
3
31
|
with open('Marker_200Hz.txt') as f:
|
1
コード修正
test
CHANGED
@@ -3,12 +3,6 @@
|
|
3
3
|
with open('Marker_200Hz.txt') as f:
|
4
4
|
|
5
5
|
lst = [s.split() for s in f.readlines()]
|
6
|
-
|
7
|
-
lstX = [v[2::3] for v in lst]
|
8
|
-
|
9
|
-
lstY = [v[3::3] for v in lst]
|
10
|
-
|
11
|
-
lstZ = [v[4::3] for v in lst]
|
12
6
|
|
13
7
|
lstX = list(map(list, zip(*[v[2::3] for v in lst])))
|
14
8
|
|