STO

Calculator Key: Sto

Member Of Menu: 
None
Argument Types: 
Any
Symbol
Expression
Result Type(s): 
None
Invertible: 
No
Valid In Expression: 
No
Stack Diagram: 
Item1 Symbol2
Item1 Expression2

This operation is used to store an item on the stack into a named symbol. Anything which can be put onto the stack can be stored. The top of the stack is expected to be a symbol (for example 'X' to store to the X variable). Below that is the value to store in that symbol. After execution, both these values are popped from the stack. The symbol is created in the current directory.

Also, it is possible to change a particular item in a list, vector or matrix using this operation. If the variable X has a value which is a list, then you can change the second item in that list by pushing the new item and then 'X(2)' to the stack. When executing this operation, it treats the expression like a symbol and an index into the list associated with that symbol. If the value is not a list or the index is out of the bounds of the list, an error is returned. In this case, the symbol is expected to be found in the current directory and that value is the one updated.

Similarly, if X is a vector, then storing a value into 'X(2)' will change the second value in the vector. The value being stored must be a real or complex value. Finally, if X is a matrix, then storing a value into 'X(2,3)' will change the value at the second row, third column. Again the value being store must be real or complex.