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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by