How can I load a *.csv file which includes text and numerical data in LOGO?
如何在LOGO中加载包含文本和数字数据的* .csv文件?
e.g. N 43.876 W
例如N 43.876 W
2 个解决方案
#1
Since this is SO I assume you're meaning within code.
因为这是我所以我认为你在代码中是有意义的。
Basically you're reading in a line, and parsing it (looking for commas, spaces, pipes, whatever you use to delimit), and doing a split (most languages support this in their string libraries) to get an array of your values. If you know which value should be an int then you convert it.
基本上你正在阅读一行,并解析它(寻找逗号,空格,管道,你用来分隔的任何东西),并进行拆分(大多数语言在它们的字符串库中支持它)来获取你的值数组。如果你知道哪个值应该是int,那么你转换它。
If you mean so you can look at it yourself - use notepad, wordpad, word, excel, openoffice, pspad, vim, pico, whatever you want.
如果你的意思是你可以自己看一下 - 使用记事本,wordpad,word,excel,openoffice,pspad,vim,pico,无论你想要什么。
EDIT: Now that you've included more info - This resource includes file reading and extracting information from files in LOGO.
编辑:现在您已经包含了更多信息 - 此资源包括文件读取和从LOGO中的文件中提取信息。
#2
Here's some very basic File IO code using LOGO.
这是一些使用LOGO的非常基本的文件IO代码。
I used FMSLogo on Windows.
我在Windows上使用了FMSLogo。
Assuming the file test.csv is in the same directory as the fmslogo binary
假设文件test.csv与fmslogo二进制文件位于同一目录中
OPENREAD "test.csv
SETREAD "test.csv
SHOW READLIST
The key part here is SHOW READLIST which prints out the contents of the current line and the moves the file pointer to the next line.
这里的关键部分是SHOW READLIST,它打印出当前行的内容,并将文件指针移动到下一行。
#1
Since this is SO I assume you're meaning within code.
因为这是我所以我认为你在代码中是有意义的。
Basically you're reading in a line, and parsing it (looking for commas, spaces, pipes, whatever you use to delimit), and doing a split (most languages support this in their string libraries) to get an array of your values. If you know which value should be an int then you convert it.
基本上你正在阅读一行,并解析它(寻找逗号,空格,管道,你用来分隔的任何东西),并进行拆分(大多数语言在它们的字符串库中支持它)来获取你的值数组。如果你知道哪个值应该是int,那么你转换它。
If you mean so you can look at it yourself - use notepad, wordpad, word, excel, openoffice, pspad, vim, pico, whatever you want.
如果你的意思是你可以自己看一下 - 使用记事本,wordpad,word,excel,openoffice,pspad,vim,pico,无论你想要什么。
EDIT: Now that you've included more info - This resource includes file reading and extracting information from files in LOGO.
编辑:现在您已经包含了更多信息 - 此资源包括文件读取和从LOGO中的文件中提取信息。
#2
Here's some very basic File IO code using LOGO.
这是一些使用LOGO的非常基本的文件IO代码。
I used FMSLogo on Windows.
我在Windows上使用了FMSLogo。
Assuming the file test.csv is in the same directory as the fmslogo binary
假设文件test.csv与fmslogo二进制文件位于同一目录中
OPENREAD "test.csv
SETREAD "test.csv
SHOW READLIST
The key part here is SHOW READLIST which prints out the contents of the current line and the moves the file pointer to the next line.
这里的关键部分是SHOW READLIST,它打印出当前行的内容,并将文件指针移动到下一行。