Skip to content

Commit 0d64d28

Browse files
committed
up
1 parent cb068e8 commit 0d64d28

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/src/basics/Variable_metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ state_priority(important_dof)
197197

198198
## Units
199199

200-
Units for variables can be designated using symbolic metadata. For more information, please see the [model validation and units](@ref units) section of the docs. Note that `getunit` is equivalent to `get_unit`.
200+
Units for variables can be designated using symbolic metadata. For more information, please see the [model validation and units](@ref units) section of the docs. Note that `getunit` is not equivalent to `get_unit` - the former is a metadata getter for individual variables (and is provided so the same interface function for `unit` exists like other metadata), while the latter is used to handle more general symbolic expressions.
201201

202202
```@example metadata
203203
@variable speed [unit=u"m/s"]

src/variables.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ setmisc(x, miscdata) = setmetadata(x, VariableMisc, miscdata)
587587
"""
588588
getunit(x)
589589
590-
Alias for [`get_unit(x)`](@ref).
590+
Fetch the unit associated with variable `x`. This function is a metadata getter for an individual variable, while `get_unit` is used for unit inference on more complicated sdymbolic expressions.
591591
"""
592-
getunit(x) = get_unit(x)
592+
getunit(x) = Symbolics.getmetadata(x, VariableUnit, nothing)
593593
"""
594594
hasunit(x)
595595

0 commit comments

Comments
 (0)