diyvorti.blogg.se

Netlogo lists
Netlogo lists




netlogo lists
  1. #Netlogo lists how to
  2. #Netlogo lists update
  3. #Netlogo lists code

This means that, for some patches, filter [current-inner-list -> (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) test-ask-command

#Netlogo lists code

You could have have: abs (varA - item 1 some-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) does the job.Ī note: this code with filter does not currently work with your example, because my-list does not currently contain enough combinations of values to cover all patches. I guess it can be done in at least a couple of ways.įor example, for the condition in which you want to apply this interval, instead of having something like: varA = item 1 some-list

netlogo lists

This only requires you to devise an arithmetical condition that mirrors what you want.

#Netlogo lists how to

On how to count how many lists are in my-listĮach inner list is just an item of my-lists, so length my-lists will tell you how many inner lists are there.

#Netlogo lists update

Then I have a "fundamental" question : when one patch will be checked, his temp-varC updated and varA updated too based on the values in my-list : can it still be elligble in that loop for a next update of temp-varC ? Because varA will change so the combination of "items" will change and it can have an updated temp-varC (but I don't want that!). The code is now working thanks to understanding better how list work.ġ) I'm however missing how to count how many list there are in the main list - or how many lines there are in the original txt file I mentionned in the beginning.Ģ) I'd like varA to be inside, let's say, -1 / + 1 around the value of item 1 item n my-list, something like here-below that does not work The idea is that for each list (for example, the last value of the list is used to do the little math afterwards for the patch that patches the criteria of having year = 2015, varA= 3 and varB=2, I though it would be easier to store it in the patch as a temporary variable. here I just create patches with different values that also appear in the list I'm still new to object-oriented modeling. See below the reproducible code, with my-list instead of yield-data, except for the procedure to test for which I struggling. I'm not there yet, I first aim to figure out how to look-up for values inside the my-list When I run the model (land use model), for each patch, a value from the list of lists ( yield-data from above) must be used in a simple arithmetic that will define its next land use category. set yield-data sentence yield-data (list (list file-read file-read file-read file-read file-read))

netlogo lists netlogo lists

When I setup my model, I also upload a csv file containing multiples columns, after some research, I found that it is read as a list of lists (each line being a list).






Netlogo lists