How to find inverse of concatenate

Suppose i have a matrix
r=[1 2 3]
g=[4 5 6]
b=[7 8 9]
rgb=cat(3,r,g,b)
Now how could I recover r,g,b matrix from rgb matrix

 Accepted Answer

r = rgb(:, :, 1);
g = rgb(:, :, 2);
b = rgb(:, :, 3);

1 Comment

how about programmatically, without doing each line manually?

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!