Concatenate matrices not the same size - without NaN
Show older comments
Hello,
I am trying to concatenate several matrixes having different sizes (rows and columns).
In order to have the same number of rows and columns so they can be concatenated, I want all the non-existant values of the smaller matrices to fill up with a constant value, so that in the end, all matrices have the same dimensions, which are the greatest number of lines among all matrices by the greatest number of columns among the matrices.
So, to sum up: I have, for example, two matrices A = [1 2 3; 4 5 6; 7 8 9] and B = [1 2; 3 4], and I want a 3D-matrix C = [1 2 3; 4 5 6; 7 8 9] and [1 2 a; 3 4 a; a a a] (with 'a' a given constant).
I tried to do this with the fillmissing function, but it seems it only works when there are NaN in the matrices? Here my matrices are images so the pixels I want to add don't exist at all.
Is there an existing function for this, or do I have to do it "manually"?
Thank you!
Nicolas
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!