I am looking for the best way to adjust the same field, y, of an array of mutable structs, x to the same number.
x[:].y=0 kind of thing. In matlab I've seen it done using the deal() function. How can I do this in Julia?
I am looking for the best way to adjust the same field, y, of an array of mutable structs, x to the same number.
x[:].y=0 kind of thing. In matlab I've seen it done using the deal() function. How can I do this in Julia?
Don't be afraid of writing the most obvious thing: a loop! It will be efficient in Julia. For example something like
for el in x
el.y = 0
end