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

 Risposta accettata

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy il 14 Ago 2018
Modificato: Yuvaraj Venkataswamy il 14 Ago 2018

2 voti

5 Commenti

Lanceric Tse
Lanceric Tse il 14 Ago 2018
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

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by