The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Creating attributes
I am trying to create an attribute with existing variables containing hyphens.
ex: a-1
However, when I try to use the AttributeConstructor in conjunction with this variable name, it misinterprets this as the variable a (nonexistent) subtracted by 1.
I have worked around this by using the Attribute renaming facility, however this is proving cumbersome as 120 of my 154 variables contain hyphens.
Is there an easier way to encapsulate a variable name containing ambiguous characters such as the hyphen?
Thanks,
- Pat
ex: a-1
However, when I try to use the AttributeConstructor in conjunction with this variable name, it misinterprets this as the variable a (nonexistent) subtracted by 1.
I have worked around this by using the Attribute renaming facility, however this is proving cumbersome as 120 of my 154 variables contain hyphens.
Is there an easier way to encapsulate a variable name containing ambiguous characters such as the hyphen?
Thanks,
- Pat
0
Answers
in RM 4.4 there is a new operator called "ChangeAttributeNamesReplace" which can be used to replace all non-word characters (regular expression for replace_what is '\W') by an empty string or for example an underscore (replace_by could be "_"). If you apply this operator to all attributes (regular expression for the attribute names parameter would be ".*") then you end up with attribute names which can be used by the AttributeConstruction operator.
Hope that helps,
Ingo