フィルターのクリア

insert zero column in a m×n matrix ?

23 ビュー (過去 30 日間)
Rakesh Praveen
Rakesh Praveen 2011 年 11 月 2 日
hello, i want to insert a zero column in the beginning of a matrix. say for example, if i have 5×5 matrix. if i want to insert zero column in the beginning then the matrix will be 5×6 matrix, so now the first column in this matrix will be zeros. how do i do it? need some help. Thank you.

採用された回答

Sven
Sven 2011 年 11 月 2 日
For a given matrix A:
A = rand(5,5);
Using square braces to concatenate:
A_zeros = [zeros(size(A,1),1) A];
Using the cat() command:
A_zeros = cat(2, zeros(size(A,1),1), A);
  1 件のコメント
Rakesh Praveen
Rakesh Praveen 2011 年 11 月 2 日
Thank you Sven.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by