Adding 1d matrices of different sizes

Jun 27, 2010 at 10:12pm

Adding 1d matrices of different sizes

I wanted to add a 2cell matrix with a 5 cell matrix with the result being that the 3 cells that are extra to keep their original value. But I can only add up those matrices if they are the same size, apparently. And if I change the 2cell matrix to be a 5 cell matrix, the 2 cells repeat themselves in the new matrix ad infinitum (ex in this case: [200. 300., 500. 600] become [200. 300., 500. 600., 200. 300., 500. 600., 200. 300.] .. and this ruins everything as pointed above.

The desired result should be 200. 500., 300. 600., 0. 0., 0. 0., 0. 0.

– Pasted Max Patch, click to expand. –

Thank you all for any input!

#51086
Jun 28, 2010 at 8:20am

I’ve mistaken about that part with “ad infinitum:. It seems that the values stretch. But I still don’t know how to mix those 2 matrices.

#183275
Jun 28, 2010 at 4:45pm

I am not sure of what you, but her’s what I have understood:

– Pasted Max Patch, click to expand. –

Is that what you want ?

#183276
Jun 28, 2010 at 9:23pm

I really appreciate your help, Ad.!!! What you did is great!

But unfortunately, once I change the dimension of the matrix with non-zero values (in this case [dim 1 1]), everything changes back to numbers repeating themselves! And when I change back to [dim 2 1], it stays the same!

May I ask what the @adapt 0 does? I don’t see it in the help file. And by the way.. It seems I don’t need the second matrix that goes into the right inlet of jit.op as it works without it (jit.op outputs the desired 200. 500., 300. 600., 0. 0., 0. 0., 0. 0. matrix without me clicking on the respective matrix). Unfortunately that lasts, as mentioned, until I play with de dim values (and I really need to have access to that). After that, i have to restart the patch to reset to what you did!

Do you know how to fix this?

and the last version of the patch ..

– Pasted Max Patch, click to expand. –
#183277
Jun 28, 2010 at 9:33pm

Well, I tested the patch without @adapt 1 and it works as well (but only without making any changes to dim). :(

#183278
Jun 28, 2010 at 11:03pm

lately, when visiting this forum I feel like I am going to the shrink! I tell my problems and I end up giving the answers myself, but not before talking to the psychiatrists on duty! :P

Once again @usedstdim came to the rescue!

– Pasted Max Patch, click to expand. –

Thank you Ad. for your patience and help!

#183279
Jun 29, 2010 at 7:01am

nO problem guy! I don’t really have impression to have helped you…I do understand now what you wanted with your final patch :)

Tious

#183280

You must be logged in to reply to this topic.