Next: , Previous: , Up: table   [Contents]


8.2.59.37 table.setvar

Method: out = setvar (obj, varRef, value)

Set value for a variable in table.

This sets (adds or replaces) the value for a variable in obj. It may be used to change the value of an existing variable, or add a new variable.

This method exists primarily because I cannot get obj.foo = value to work, apparently due to an issue with Octave’s subsasgn support.

varRef is a variable reference, either the index or name of a variable. If you are adding a new variable, it must be a name, and not an index.

value is the value to set the variable to. If it is scalar or a single string as charvec, it is scalar-expanded to match the number of rows in obj.