-
-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Description
I'm struggling to figure out how to properly create an Axis
From a vector of symbols, state_names, I want to create an axis that can be used for the variable x and the matrix A in
x' = A*xI guess it would be possible to have a slurping constructor that accepts something like the following
julia> ax_x = Axis(state_names...)
FlatAxis()and internally dispatches to the NamedTuple so I do not have to figure out this awkward way of constructing such an Axis.
julia> ax_x = Axis((; (state_names .=> (1:sys.nx))...))
Axis(x1 = 1,)Indeed, if I define
function ComponentArrays.Axis(names::Symbol...)
Axis((; (names .=> (1:length(names)))...))
end
julia> ax_x = Axis(state_names...)
Axis(x1 = 1,)I seem to get what I want :)
Metadata
Metadata
Assignees
Labels
No labels