On Thu, 24 Jun 2010, Mathieu Bouchard wrote:

The trick is to use a [#slice] to extract the information to sort about ; however the [#slice] needs to know the height of the grid, so you need a [#dim]. the [#unpack] and msgbox is only one way to do it in two steps : you can also do [# * (1 0)] [# + (0 1)] and there are a bunch of other equivalent ways. Then, when you have a grid of size (n 1) and you need to get it to size (n), you'd do something like [#fold +] or [#fold put],

Actually, in the case where you only want the last column, you can skip [#slice] and [#dim] and just use [#fold put].

Therefore, if you only want the last column, you can flip the grid using [#reverse 1] before using [#fold put].

And if you know the number of columns in advance, you can select the column using a one among zeroes, as in [#inner (5 # 1 0 0 0 0)], which in this case is the same as [# * (1 0 0 0 0)] then [#fold +] (this equivalence only works with simple cases of #inner, those where the right-inlet has only one dim)

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
#N canvas 536 202 450 300 10;
#X obj 39 144 #store;
#X obj 39 163 display;
#X msg 39 30 4 5 # 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 4 5 6 7 8;
#X obj 39 49 t a a;
#X obj 39 106 #grade;
#X obj 39 125 #outer ignore (0);
#X obj 39 87 #fold put;
#X obj 39 68 #reverse -1;
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 3 0 7 0;
#X connect 3 1 0 1;
#X connect 4 0 5 0;
#X connect 5 0 0 0;
#X connect 6 0 4 0;
#X connect 7 0 6 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to