On Sun, 11 Oct 2009, Andy Wilson wrote:

on a related question: a controller is sending me lists of numbers, 20 at a time. I'd like to be able to store this list and later access it by index.
what's the neatest way to achieve this?

You can use a 1-dimensional array to store 2-dimensional data. For example, if you want keep a memory of the last 50 instants for which you have controller data, you can use an array of 1000 elements, and use [tabread] with the instant number times 20, plus the number of the element.

this assumes numbering the instants from 0 to 49 and the elements of an instant from 0 to 19. If you want to number things starting at 1, it gets complicated by an extra subtraction if you care about using all the array space you are reserving.

if you have several controllers, you can do something similar... add a 3rd axis to your data: the controller number. for example, with 4 controllers, use [tabread] with the instant number times 80, plus the controller number times 20, plus the number of the element.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to