Adding a row of ones

조회 수: 4 (최근 30일)
Renea Young
Renea Young 2021년 11월 20일
댓글: Renea Young 2021년 11월 21일
I want to add a row of ones to the first row of a=[1 2 3 4;5 6 7 8;9 10 11 12; 13 14 15 16]. This 4x4 will become 5x4. Any suggestions?

채택된 답변

Atsushi Ueno
Atsushi Ueno 2021년 11월 20일
a = [1 2 3 4;5 6 7 8;9 10 11 12; 13 14 15 16];
b = [ones(1,size(a,2)); a]
b = 5×4
1 1 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  댓글 수: 1
Renea Young
Renea Young 2021년 11월 21일
Thank you

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by