Combine 2 matrices into 1

I have a matrix
a= 1 1 1
1 1 1
1 1 1
b= 2 2 2
2 2 2
2 2 2
How do I combine them into
1 2 1 2 1 2
1 2 1 2 1 2
1 2 1 2 1 2

 Accepted Answer

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy on 14 Aug 2018
Edited: Yuvaraj Venkataswamy on 14 Aug 2018

5 Comments

which command?
Check the above link, that will provide answer.
if true
Y = b(:,[1;1]*(1:size(b,2)));
Y(:,1:2:end) = a
end
@Yuvaraj Great
Thank you @Kalyan

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!