# HP 48gII Advanced User's Reference Manual Page 99

Graphing calculator.

Program:
1 CF
a DUP SIZE
DUP SIZE
IF 1 ==
THEN 1 SF 1 +
SWAP OBJ OBJ
DROP
1 + ROLL
ELSE DROP2 a OBJ
END DUP OBJ DROP * Duplicate the dimension list and compute the total
SWAP OVER 2 +
ROLLD LIST
1 p DOSUBS
OBJ 1 + ROLL
IFERR
IF 1 FS?
THEN OBJ DROP
LIST
END ARRY
THEN
OBJ
IF 1 FC?C
THEN DROP
END  n m
« 1 n
FOR i
m LIST
Make sure the flag 1 is clear to begin the procedure.
Retrieve the dimensions of the array.
Determine if the array is a vector.
If array is a vector, set flag 1 and add a second
dimension by treating the vector as an n × 1 matrix.
Disassemble the original vector, leaving the element
count, n, in level 1.
Roll the elements up the stack and bring the "matrix"
dimensions of the vector to level 1.
If array is a matrix, clean up the stack and decompose
the matrix into its elements, leaving its dimension list
on level 1.
number of elements.
Roll up the element count and combine all elements
into a list.Note that the elements in the list are in row-
major order.
Recalls the program and uses it as an argument for
DOSUBS (DOLIST works in this case as well).
Result is a list of transformed elements.
Disassembles the result list and brings the array
dimensions to level 1.
Begins the error-trapping structure. Its purpose is to
find and handle the cases when the result list contains
symbolic elements.
Was original array a vector? If the original array was
a vector, then drop the second dimension (1) from the
dimension list.
Convert the elements into an array with the given
dimensions. If there are symbolic elements present, an
error will be generated and the error clause which
follows will be executed.
Begin the error clause.
Put the array dimensions on levels 2 and 1. If the
array is a vector, level 1 contains a 1.
Is original array a matrix? Clear flag 1 after
performing the test.
Drop the number of matrix elements.
Store the array dimensions in local variables.
Begin local variable structure and initiate
FOR...NEXT loop for each row.
Collect a group of elements into a row (a list).
RPL Programming Examples 2-21 #### This manual is also suitable for:

49g+ 