问题
I am a beginner in netlogo. I find the Netlogo Manual not always as explicit as I feel it should be, as exemplified by the folowing task. My feeling is that this task ought to be relatively simple, but so far I have not been able to accomplish it. I have searched for hints on this forum to help me, but perhaps my problem is so simple that nobody has yet come up with a corresponding question.
The task is: Write data into columns of an Excel file such that for each tick six data points form a row of data across six columns (say across columns A, B, C, D, E, F of the Excel file). I do not find the command to assure that after each data point, having been entered into its column, the next column is selected to enter there the next data point.
This starts already with the headings of the columns for which I give the commands in the setup procedure as below:
...
if (file-exists? "TO_test.csv") [carefully [file-delete "TO_test.csv"] [print error-message]]
file-open "TO_test.csv"
file-type "number,"
file-type "name,"
file-type "age,"
file-type "height,"
file-type "income,"
file-type "status,"
file-close
....
The output in the Excel file is then
number, name,age,height,income,status,
all in one comlumn. I use the 'type' command because that assures that entries are made in the same line. I added the ‘,’ to each string because I believe to have picked up somewhere that this causes the shift to the next column (which, however, it does not). If I use 'file-print' instead of 'file-type' I get an entry in successive lines instead of columns, because here the ‘,’ causes a ‘return’ command.
What I would like to get is the following (where the first line shows the given headings of the Excel file):
A B C D E F
number name age height income status
来源:https://stackoverflow.com/questions/20690569/create-output-in-an-excel-file-consisting-of-data-rows