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

 Réponse acceptée

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy le 14 Août 2018
Modifié(e) : Yuvaraj Venkataswamy le 14 Août 2018

2 votes

5 commentaires

Lanceric Tse
Lanceric Tse le 14 Août 2018
which command?
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy le 14 Août 2018
Check the above link, that will provide answer.
if true
Y = b(:,[1;1]*(1:size(b,2)));
Y(:,1:2:end) = a
end
KALYAN ACHARJYA
KALYAN ACHARJYA le 14 Août 2018
@Yuvaraj Great
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy le 14 Août 2018
Thank you @Kalyan

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by