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

 채택된 답변

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018년 8월 14일
편집: Yuvaraj Venkataswamy 2018년 8월 14일

2 개 추천

댓글 수: 5

Lanceric Tse
Lanceric Tse 2018년 8월 14일
which command?
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018년 8월 14일
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 2018년 8월 14일
@Yuvaraj Great
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018년 8월 14일
Thank you @Kalyan

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by