this might sound like a dumb question but, does anyone know how can I get a list of the variables (including auxiliary and dummies) from my Netlogo code?
I think the Reflexion extension might be what you're looking for.
As per the documentation:
reflection:globals reports a list with the names of all global variables breeds
and:
reflection:breeds reports a list of all breed names, and all their variables, default variables included.
Related
Is there an easy way to figure out all places where a variable or parameter is being utilised in annylogic. Trying to locate where each variable is used can be a pain during debugging.
Sure. Just "ignore" it in the properties and compile the model.
You will get a list of errors for all places where it is called. Double-click on each error and AnyLogic even takes you there :)
Else, you can also use the AnyLogic search functionality.
in order to get some relief for that pain if your model is too big, all your variables should be private and you create setters, so each time you change your variable, you required to use a set function.
This doesn't solve your question, but it tells you what to do in future models to make it easier for you
check this video
https://www.youtube.com/watch?v=gNBfdB6YF7o
I want to define a few variables in a simulink model. The matlab function block doesn't work because the variables are local. The variables are not input to other blocks, but instead, the variables are parameters to other blocks.
Basically, I want to have a block where I can define a bunch of variables that set the parameters for other blocks. I did this once in the past more than a few years ago now, but I can't find or remember how to do it.
I thought I used a block, but potentially, I set the variables somewhere in model settings or something. I can't remember, and I am not having luck finding it. Any help is much appreciated! I feel this is simple, but I just can't find the solution.
You can do this by defining your data in the model's "Model Workspace", like this:
. There's more about the Model Workspace in the doc. There are various options as to where you can store the parameters.
You can use Simulink data dictionary or model workspace to store the variables/Parameters. go through this link to get more info Usage of the variables/Parameters/Signals for simulink models
I'm trying to make my model compatible with an interface framework that can't handle the csvs I normally export to, and requires lists. What I need to do, specifically, is export a list of lists of variables associated with each of a certain breed of agent.
Ideally:
set master-list (foreach person set traits-list list (who) (color) (heading) (xcor) (ycor) (etc...))
But the primary issue I'm having is that after the first two variables set up in the set traits-list list (items) way, it starts throwing up errors on any subsequent variables. I can just lput each individual variable, but that seems like a really unnecessarily messy way to set it up. Am I missing something?
I've tried seeing if it's the individual variable that's the issue, but the error persists no matter what the third variable is.
If anyone wants to look at the complete code in question, I'm trying to make https://github.com/efyoungud/stationfire work with https://github.com/hlynka-a/SRTI.
JenB had the answer with needing the bracket.
Final, functional code:
ask people [ foreach [self] of people [
set traits-list (list (who) (color) (heading)(xcor)(ycor)(shape)(breed)(hidden?)(size) (alarmed?) (age)(visited?)(group-number) (group-type) (group-constant)(speed) (leadership-quality) (leader) (goal) (energy)(speed-limit)
)]] ; doesn't include next-desired-patch or path because that's calculated each step and doesn't need to be exported
set master-list [traits-list] of people
end ```
Is there an equivalent function in FreeMat? I can't seem to find one and the documentation is poorly organised.
Any recommendations for work-arounds?
I am not sure if that helps, but I am not using this function in Matlab either. I always organise my objects in a list that is either stored in a global workspace or passed around other to objects.
So what you could do is create an Object like a list that has a search and add function. Put it in global scope and make it a singleton (I know, friends don't let friends write singletons). This way you can find all you add to this list easily.
You might want to check out the "service locator" pattern: https://en.wikipedia.org/wiki/Service_locator_pattern
I think the findobj() function in MATLAB does someting similar.
I'm trying to modify a variable belonging to a specific patch in NetLogo.
set [informed] of target [informed] of target - floor(diff / 2)
I get the error: This isn't something you can use "set" on.
'target' is a specific patch I've defined earlier.
I've used syntax like this ([variable-name] of specific-patch) at the end of expressions to define other variables, but it doesn't work when that's the variable you're trying to define. Removing brackets just results in a different error. I'm not sure whether I'm missing some major fundamental understanding or some silly syntactic mistake. Any help would be appreciated, thanks.