Adding 1d matrices of different sizes

ygreq's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

Thank you all for any input!

ygreq's icon

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.

Ad.'s icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

Is that what you want ?

ygreq's icon

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 ..

Max Patch
Copy patch and select New From Clipboard in Max.

ygreq's icon

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

ygreq's icon

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!

Max Patch
Copy patch and select New From Clipboard in Max.

Thank you Ad. for your patience and help!

Ad.'s icon

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