I need to add a new matrix to a previously existant matrix, but on his dimension coordinate. I know this is hard to understand, so let's see it on a example:
I've a matrix like this:
480x640x3
And I want to add the following one:
480x640x6
The result has be this: (6+3 = 9)
480x640x9
As you can see it adds but on the 3rd dimension.
For concatenating along higher dimensions, use the function CAT:
newMatrix = cat(3,matrix1,matrix2);
I would say that gnovice's answer is probably the best way to go, but you could do it this way too:
matrix1(:,:,4:9) = matrix2;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With