|
We're glad you came by, but you might find what you're looking for elsewhere. TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it. Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope. |
Returns the size of a list, matrix, or string.
dim(list-matrix-or-string)
Menu Location
- Press 2nd MATH to enter the MATH menu.
- Press D to enter the String submenu.
- Press 3 to select dim(.
This command works on all calculators.
1 byte
The dim() command returns the size of a list, matrix, or string:
- The number of elements for a list.
- The number of characters for a string.
- A list of {number of rows or columns} for a matrix.
This command is critical to using any of these objects, for instance, if you want to write a For..EndFor loop to look at every element.
However, unlike the TI-83 series version, you can't use the dim() command to change the size of anything. Use mid() to get a smaller list or string (subMat() for a matrix), or use newList() and newMat() to create a list or matrix of a specific size.
:dim({1,2,3,4,5}
5
:dim("TI-Basic Developer")
18
:dim([1,2,3;4,5,6])
{2 3}Optimization
For matrices, using rowDim() and colDim() is usually better in all practical situations, and you don't have to remember which number goes first.
