resize a matrix non destructively?
Hi,
I have a multiplane matrix which is being filled data one row at a time using jit.fill and an offset command.
I want to resize the matrix on the fly, taking its dimensions from say 1×100 to 1×10.
When i send the matrix a "dim 1 $1" command the matrix is resized correctly but all the data is deleted.
Is there a way to resize the matrix but keep all the data intact? I thought i might be overlooking an easy command?
Otherwise I guess i’ll have to keep a 2nd copy of the matrix, resize the 1st matrix then refill it with the data from the second matrix? How does this sound?
Look forward to hearing some opinions,
Will
will jit.submatrix help?
just connect two jit.matrix objects as below:
[jit.matrix 1 100]

[jit.matrix 1 10]
Thanks for the input, I’ve spent the day looking into these and other various ways forward but have had no luck,
I guess I should have been more clear about what im aiming for,
I have a multiplane matrix 6 planes each 1 by 1024 filled with values which i want to keep intact.
1 Using [number box] id like to reduce the matrix down to "1 by [number box]" keeping the values that exist in this range unchanged.
2 Id then like to be able to increase the matrix to "1 by [number box}" any new cells made should be filled with 0’s.
So far i’ve found a convoluted way of almost achieving 1, although instead of reducing the matrix’s dimensions the values im wanting to get rid of are replaced with zeros this is not a massive problem.
However when I scale the matrix back up the new values are not replaced with zero’s, they’re going back to what was previously in the matrix.
I’ve attached a patch which demonstrated the problem. opening up p interface and p matrix planes shows what im getting at. using the lcd in ‘p interface’ puts values into the matrix. scrolling the ‘total objects’ number box increases and decreases the matrix. the matrix is viewable in ‘p matrix planes’
If anyone could take a look at the patch id really appreciate it, thought id be able to sort it out in a couple of hours but have been at it all day with no luck so far!
Attachments:
Sorry I don’t have time to study your patch, but maybe this example will be helpful(?). The example uses a 4plane 256×256 matrix for easy visualization, but it could easily be adapted to a 6plane 1×1024 matrix.
begin_max5_patcher
789.3oc2WtsaiBCDF9ZxSgEpWlFYLmJ6UceNVUUY.2T2B1HrQM6V02801.4P
S4PZfzpdQriMCv+74wyXdcgkcLeCQXC9E3O.KqWWXYYlROgUyXK6b7ljLrvX
lcBOOmvj1KquljrQZlOkWEmQtNIil7LPxAkjGnYYslUfkIORYquujjHqecNA
qfKaacb0cH3JH3tlaglZdt73mt1Ip847.mIY3bh4R+tjh29FXU4TVFQZToyd
lKn+yXtCR8J1ZKuR1ZLTO4aKVnaVNRJjSDB7ZxwTPjRyERboD.AJOJUHUSPX
ofqb.WgZsOixHI7Jl4lPcyHWMQVBt4FcaTnt0E0AiBOQFgNEF0Bz5oj+sfTK
PaavceB7wHunz7QzqnjTnYkBY8D33aTYCTBC6MvwaNCblXn7DUtp3EJKk+xv
aahLL.4Grs6C8e2d8xCcGTmtyxIdcV6o4XYIcCPYQy+7.IOhK09h42sUBR8t
GfyHxhXBFPCDMflyngNwmxauu1GmbPJAwfLPRFQAt9x0hPdZvDXZcg8SIm4j
RdcQoXLasgOpeFG5LfUUdLorObTm6nN1wG1KMfCSCEKn4U4uam0w.RwAAop3
fovaZuUUP+mIbSkyTnpGikTNa+JGAnZWzQ2AaZ15gGgeptjdypvLA85Xvw.8
nu4LeFnWGEDwO2lPbXx5UeVgdOI0OfCInKdHphapZbqt.wvHpoLgacWSUyNX
j2OspD6UtMlt9CK2NL5f06dib5Cct+zPWFGmVWYZ.93ZR2FzaZMzWxgQm7jR
5vIFmJHmZLjeylP+dK39sKDxnRymr8tOT13n54OjgBdUYR6CtIgBXmulRDRJ
yTudOazmMcOidjllRLWGtsfWZAWUmoQCcrfNVI8tWWGZx8xpovYfStnnU95S
c.0cH+sCNWwphSAnIVrd6zGbewBmBwNDYOwEajqqVdQA6jZTv4qzwrWw6zTp
Oxw.RUjvNppGLET0YnPfvK6dHslbGRSdWTMMps0NWTI4N8QYm6BGbDRJ7f.t
4VRQiTQWPHM8owNSEMpxnmghTCdaw+AxHYm5
end_max5_patcher
Oops. A small misspelling in the above patch: the word "dsdimstart" should be changed to "dstdimstart".
Corrected version below.
begin_max5_patcher
788.3oc2WtsaiBCDF9ZxSgEpWlFYLmJ6UceNVUUY.2T2B1Hvnlcq5695CPNz
TNjFHspWD6fYL7Oed7LlWWXYGy2PprA+B7Gfk0qKrrzCoFvp4ZK6b7ljLbk1
L6DddNgIrWZtmfrQnGOkWGmQtNIil7LPvAkjGnYYslUfEIORYquujjHLuNmf
UvkssNtpNDbEDbWyTno5mKO9oqchZeNOvYBFNmnu0uKo3suAVcNkkQDZU5rm
4Uz+oM2AIeEaskWKZMFpF7sEKTMKGIExIUU30jioPkHklWIvkB.DHcIy.DVJ
3JGvUn1IjQYjDdMSOKT2PxUgjkfatQ0FEpZcQc.ovSDRnSARsD0Lj3uEDi.s
sA28I3Gi7hTyGguhRRghURj0SjiuVkMPILr2HGu4LxYhgxSTwphWnrT9KCuu
IRy.jev1tOz+c60KOzcPc5NKm30YkmliEkzM.oEM+yCj7HtT4K5e2VWQL6d.
NiHMhNX.MPz.ZNiF5DeRu8diON4fT.hAYfjLhDb8krEg7TfIP25B6mRNyIk7
5hRwX1ZMej+zNzY.q57XRYe3vj6vD63C6kFvgogjEz7572sy5X.I4PEot3fg
vaZmpLn+yDtIyYVIKHiETNa+JGAHiK5n5fMMa8vivOUUSuYUXlftIFbLPO5a
NymA50QAQ7ysIDGlrdlyJz6Qo9AbHAUwip53lpF2pJPLLhZJS3Z5ZpZ1Ai79
oUkXuxswz0eX41gQGzr6MxoOz49SCcYbbpoxz.7wUmtMn2zZnujCiN4IkTgS
LNshbpwP9MaB86sf62tPHsJ0ex169RYsipF+PFVwqKSZevMIT.670TRkfxz0
q2yF0YS2ynGoooD88gaK3kVvk0YZzPGKniURu600glburZJbF3jKJZku5TGP
UGxe6EmqXkwo.zDKVuc5CtuXgSgXGhrm3hMx0UIunfcRMJ37U5X1q3cZJ0G4
nAoLRXGUUWLET0YnPfvK6dHklbGRSdWTMMps0NWTI4N8QYm6BGbDRJ7f.t4V
RQiTQWPHM8owNSEMpxnmghjW71h+CbCk24E
end_max5_patcher
Hi Christopher,
Thank you! Thats almost exactly what I was looking for, I had tried the dstdimstart stuff but had gotten it all wrong, your example really makes sense of it. Your patch works brilliantly when scaling the matrix down but when I scale it back up id like the freshly viewable values to be reset to zero im going to have a look at using setcell for those bits.
Thanks again, was going a bit crazy with it!
I’m glad it was helpful. To set all values in a matrix to 0 most quickly, use the ‘clear’ message. To set them all to something else, use the ‘setall
hate to dig up old dead threads but I was looking for an answer its one of the best returns on searches for resizing matrices nondestructively, turns out you can use the method posted here and also use a submatrix object, which can then be dynamically resized without information loss
Forums > Jitter