Creating a matrix by some other matrices

Suppos I have:
a = [3;3;5;8;2;1;8;1;5];
b = 2
I want matrix c to be:
c = [3 2;3 2;5 2;8 2;2 2;1 2;8 2;1 2;5 2]
second column of matrix c is just repeated b

 채택된 답변

Image Analyst
Image Analyst 2014년 5월 12일

0 개 추천

Try this:
c = [a, b*ones(size(a))]

추가 답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 12일
편집: Azzi Abdelmalek 2014년 5월 12일

0 개 추천

[a 2*ones(size(a))]

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

질문:

Moe
2014년 5월 12일

댓글:

Moe
2014년 5월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by