davidavdav / NamedArrays.jl

Julia type that implements a drop-in replacement of Array with named dimensions
Other
120 stars 20 forks source link

Customizing dimensions names #48

Closed AntonioSaragga closed 6 years ago

AntonioSaragga commented 7 years ago

First, would like to thank you for this very useful package!

I am mostly working with arrays in three dimensions and would like to change their names, lets say, from A, B, C to i, j, k Would this be possible?

davidavdav commented 7 years ago

Ehm, yes, in several ways, but the easiest is

x = rand(2, 2, 2)
n = NamedArray(x)
setdimnames!(n, ["i", "j", "k"])

You can also set the dimnames in the constructor, but then you need to also set the names of the indices as well.