Greetings All
I found arraysize but that doesn't seem to give me the correct output
Example: If I create a table with "; arrayx 0 .1 .3 .5 .3 .1" I'm trying to get the output to be 5 since there are 5 values in it.
zero each index.
Example If I create a table with "; arrayx 0 .1 .3 .5 .3 .1" is there an option to set all indexes values back to zero (or set the entire array back to zero) without creating another object like this"; arrayx 0 0 0 0 0 0"
Thanks Rick
PS: I'm using ubuntu 10.04 64bit pd .42.5 extended
Colet Patrice
----- Mail original -----
De: "Rick T" ratulloch@gmail.com À: "PD List" pd-list@iem.at Envoyé: Jeudi 4 Octobre 2012 17:47:57 Objet: [PD] Question on getting the amount of values in a table and setting table to zero
Greetings All
- I'm trying to find a way to get the total amount of values in a
table. I found arraysize but that doesn't seem to give me the correct output
Example: If I create a table with "; arrayx 0 .1 .3 .5 .3 .1" I'm trying to get the output to be 5 since there are 5 values in it.
if you set manually array values, maybe [list-abs/list-len] is the answer...
something like this:
[.1 .3 .5 .3 .1( | [list] | [t a a] | | | [list length] | | | [;arrayx resize $1( | [list prepend 0] | [list trim] | [s arrayx]
- I'm also trying to set all values in array to zero with out having
to zero each index.
Example If I create a table with "; arrayx 0 .1 .3 .5 .3 .1" is there an option to set all indexes values back to zero (or set the entire array back to zero) without creating another object like this"; arrayx 0 0 0 0 0 0"
[;arrayx const 0(
Check william brent's tabletool On Oct 4, 2012 5:50 PM, "Rick T" ratulloch@gmail.com wrote:
Greetings All
- I'm trying to find a way to get the total amount of values in a table.
I found arraysize but that doesn't seem to give me the correct output
Example: If I create a table with "; arrayx 0 .1 .3 .5 .3 .1" I'm trying to get the output to be 5 since there are 5 values in it.
- I'm also trying to set all values in array to zero with out having to
zero each index.
Example If I create a table with "; arrayx 0 .1 .3 .5 .3 .1" is there an option to set all indexes values back to zero (or set the entire array back to zero) without creating another object like this"; arrayx 0 0 0 0 0 0"
Thanks Rick
PS: I'm using ubuntu 10.04 64bit pd .42.5 extended
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 10/04/2012 05:47 PM, Rick T wrote:
Greetings All
- I'm trying to find a way to get the total amount of values in a
table. I found arraysize but that doesn't seem to give me the correct output
Example: If I create a table with "; arrayx 0 .1 .3 .5 .3 .1"
you are not creating a table with this. what you do is to set the first 5 elements of an existing table, whatever it's length is.
in order to count the elements you just set you could use [list length].
[0 .1 .3 .5 .3 .1(
|
[list length]
|
[6
|
[- 1]
|
[5\ <-- tadaa!
if you want to resize a table, use the "resize" message. [resize 19( | [s arrayx]
- I'm also trying to set all values in array to zero with out having to
zero each index.
use the "const" message.
[const 0( | [s arrayx]
fgmasdr IOhannes