cell value combinations in a matrix

Mar 7, 2006 at 12:32pm

cell value combinations in a matrix

Hello there,

i don’t know which topic covers my question, but it seems for me that this has something to do with matrix-calculations, so i thought the jitter-list might fit.
If i have a matrix with dimensions 3×1 and each cell can contain a 0, 1 or 2, there are 27 (3^3) possible combinations.
If you use the attached patch you get the example values printed to the max window. (index 1 – 0 0 0; index 27 – 2 2 2;)

So each state has its own index. Is it possible to calculate the state of the cells by the index? It should be possible as each combination shows up only once.
In the above example a 17 should result in “1 2 1″. Unfortunately i need to calculate this with much more than 3^3 combinations. So i can’t use a [coll] or similar to store all combinations.
The only valuable thing that came to my mind is that after 3^1 combinations the second cell is affected and after 3^2 combinations the third cell.
If there were more cells after 3^4 combinations the fourth cell would begin to change its content. But here i am stuck with my others ideas for days now. Please help me.

Any hints are really much appreciated. Thanks a lot.

Tobias

//
max v2;
#N vpatcher 635 240 1190 705;
#P window setfont “Sans Serif” 9.;
#P hidden message 398 233 14 196617 3;
#P hidden newex 398 208 48 196617 loadbang;
#P window linecount 4;
#P comment 232 322 264 196617 The question is if there is a possibility to calculate the state of the number boxes by the index (and not to store all possibilities an a coll-object first)? To send in a 17 and getting 1 2 1 as the result in the 3 number boxes?;
#P window linecount 1;
#N vpatcher 451 454 748 686;
#P outlet 148 129 15 0;
#P outlet 88 129 15 0;
#P outlet 28 129 15 0;
#P inlet 27 42 15 0;
#P pop;
#P newobj 95 349 73 196617 p Reverse???;
#P number 187 378 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
#P number 141 378 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
#P number 95 378 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
#P number 29 321 90 9 0 0 0 3 0 0 0 40 204 140 222 222 222 0 0 0;
#P window setfont “Sans Serif” 12.;
#P comment 187 38 21 196620 1.;
#P comment 48 38 21 196620 2.;
#P user panel 21 309 500 92;
#X brgb 255 113 9;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X done;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 201 42 147 196617 clear the max window and then click button to reset counters!;
#P button 166 41 15 0;
#P window linecount 1;
#P hidden newex 166 62 53 196617 t 1 0 0 0;
#P toggle 29 42 15 0;
#P number 29 142 90 9 0 0 0 3 0 0 0 40 204 140 222 222 222 0 0 0;
#P newex 29 62 46 196617 metro 1;
#N counter 0 1 27;
#X flags 0 0;
#P newobj 29 119 77 196617 counter 0 1 27;
#P number 328 141 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
#N counter 0 0 2;
#X flags 0 0;
#P newobj 328 119 71 196617 counter 0 0 2;
#P number 241 141 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
#N counter 0 0 2;
#X flags 0 0;
#P newobj 241 119 71 196617 counter 0 0 2;
#P number 153 141 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
#N counter 0 0 2;
#X flags 0 0;
#P newobj 153 119 71 196617 counter 0 0 2;
#P comment 63 42 100 196617 click toggle to start!;
#P hidden newex 29 228 59 196617 print index;
#P hidden newex 45 177 26 196617 t -;
#P hidden newex 29 203 74 196617 pack 0 s 0 0 0;
#P hidden newex 153 167 47 196617 gate 0 1;
#P hidden newex 153 227 57 196617 pack 0 0 0;
#P hidden newex 241 209 32 196617 sel 0;
#P hidden newex 164 197 32 196617 sel 0;
#P hidden newex 153 272 21 196617 t 0;
#P hidden newex 153 249 64 196617 match 2 2 2;
#P user panel 21 21 488 171;
#X brgb 139 255 59;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X done;
#P hidden fasten 2 0 20 0 158 296 14 296 14 35 34 35;
#P connect 20 0 18 0;
#P connect 18 0 17 0;
#P connect 17 0 19 0;
#P hidden connect 19 0 7 0;
#P hidden connect 7 0 9 0;
#P hidden connect 19 0 8 0;
#P hidden connect 8 0 7 1;
#P hidden fasten 12 0 7 2 158 179 66 179;
#P hidden connect 21 0 17 3;
#P hidden connect 14 0 7 3;
#P hidden connect 16 0 7 4;
#P fasten 27 0 31 0 34 342 100 342;
#P connect 31 0 28 0;
#P fasten 31 1 29 0 131 372 146 372;
#P connect 18 0 11 0;
#P connect 11 0 12 0;
#P hidden connect 12 0 6 0;
#P hidden connect 6 0 5 0;
#P hidden connect 5 0 1 0;
#P hidden connect 1 0 2 0;
#P hidden connect 6 0 3 0;
#P hidden connect 22 0 21 0;
#P hidden connect 14 0 5 1;
#P fasten 31 2 30 0 162 372 192 372;
#P hidden connect 12 0 6 1;
#P hidden connect 21 3 11 3;
#P hidden connect 16 0 5 2;
#P hidden connect 3 0 13 0;
#P connect 13 0 14 0;
#P hidden connect 14 0 4 0;
#P hidden connect 21 2 13 3;
#P hidden connect 4 0 15 0;
#P connect 15 0 16 0;
#P hidden connect 21 1 15 3;
#P hidden connect 33 0 34 0;
#P pop;

#24757
Mar 7, 2006 at 4:04pm

Well. As it comes from time to time.
I found a solution for this problem.
If anybody is interested. The patch is at the end of the message.

Thanks Tobias

//
max v2;
#N vpatcher 212 200 812 600;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P hidden newex 205 155 37 196617 pow 2;
#P hidden newex 136 155 37 196617 pow 1;
#P hidden newex 51 155 37 196617 pow 0;
#P comment 84 56 35 196617 index;
#P number 127 56 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 184 232 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 110 232 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 34 232 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 34 208 27 196617 % 3;
#P newex 184 131 27 196617 – 1;
#P newex 184 183 31 196617 / 16;
#P number 184 103 48 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 184 208 27 196617 % 3;
#P newex 110 131 27 196617 – 1;
#P newex 110 183 27 196617 / 4;
#P number 110 103 48 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 110 208 27 196617 % 3;
#P newex 34 131 27 196617 – 1;
#P number 34 56 48 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 34 103 48 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 34 183 27 196617 / 1;
#P comment 164 56 122 196617 number of states per cell;
#P connect 3 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 1 0;
#P connect 1 0 13 0;
#P connect 13 0 14 0;
#P hidden connect 17 0 19 0;
#P hidden connect 19 0 1 1;
#P hidden connect 17 0 13 1;
#P connect 3 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 7 0;
#P connect 7 0 5 0;
#P connect 5 0 15 0;
#P hidden connect 20 0 7 1;
#P hidden connect 17 0 5 1;
#P hidden connect 17 0 20 0;
#P connect 3 0 10 0;
#P connect 10 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 9 0;
#P connect 9 0 16 0;
#P hidden connect 17 0 9 1;
#P hidden connect 17 0 21 0;
#P hidden connect 21 0 11 1;
#P pop;

#72119

You must be logged in to reply to this topic.