# HP Forums

Full Version: How to implement an array ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I apologize in advance for my newbie question.

I have in mind a project for my HP Prime which will not be too terribly difficult to do, but which will require three one-dimensional arrays. Two of the arrays will have 256 elements in a single row or column, and the third array will have 65536 elements in a single row or column. These arrays will hold integer numbers

I have, once again, been looking at the skimpy information about programming in HP PPL in the HP Prime User Guide, but I do not see anything about creating or using arrays.

Would I have to use matrices? My thinking had been for arrays because I only need storage for integers, and matrices want to hold real or complex numbers, and I didn't want to use up that much more memory when I don't need to.

Thanks very much, in advance, for any advice you may have to offer.

smp
It sounds like you might like to use vectors, one dimensional matrices.
For example:

RANDMAT(M1,256,1,99);

Creates a random column vector, containing 256 elements. The elements will be between 1 and 99, and are saved in variable M1.

M1(5) will access the fifth element in the array, for example.
(02-19-2016 10:13 PM)DrD Wrote: [ -> ]It sounds like you might like to use vectors, one dimensional matrices.

Thanks very much, DrD. That's what I thought when I asked about matrices.
Thanks for verifying this for me.

smp
Some more facts about Matrices, Vectors and Lists as replacing Arrays
PPL - Additional Information PART I (Spanish)
Hello,

Prime has build in 1d (vectors) and 2d (matrices) objects.
If you need 3D, you can either use lists, or use lists with matrices in them.

remember that you can access sub-elements of a list by doing L(a,b,c) where a is the index in the list and b/c indexes in the list sub-element.

cyrille
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :