Halcon读取Csv文件

open_file ('5.csv', 'input', XYZ)
X:=[]
Y:=[]
Z:=[]
*读文件中一行的字符串
fread_line (XYZ, OutLine, IsEOF)

*将X Y Z 分别存储在不同的元组中
while (IsEOF==0)
*根据逗号分割一行的字符串
tuple_split (OutLine, ',', Substrings)
tuple_length (Substrings, Length)
***********************************************
* 去掉最后一个的换行符 \n
tuple_split (Substrings[Length-1], '\n ', outSplit)
Substrings[Length-1] := outSplit
*****************************************
tuple_number (Substrings, Number)
count_seconds (S1)
for Index := 0 to Length/3-1 by 1
X :=[X,Number[3*Index+0]]
Y :=[Y,Number[3*Index+1]]
Z :=[Z,Number[3*Index+2]]
endfor
count_seconds (S2)
time:=S2-S1
fread_line (XYZ, OutLine, IsEOF)
stop ()
endwhile