필터 지우기
필터 지우기

Creating a matrix by some other matrices

조회 수: 1 (최근 30일)
Moe
Moe 2014년 5월 12일
댓글: Moe 2014년 5월 12일
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일
Try this:
c = [a, b*ones(size(a))]

추가 답변 (2개)

Andrei Bobrov
Andrei Bobrov 2014년 5월 12일
c = a;
c(:,2)=b;

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 12일
편집: Azzi Abdelmalek 2014년 5월 12일
[a 2*ones(size(a))]

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by