フィルターのクリア

How to add constant values above and below of each columns of a matrix?

2 ビュー (過去 30 日間)
Nisar Ahmed
Nisar Ahmed 2022 年 11 月 4 日
コメント済み: John D'Errico 2022 年 11 月 6 日
Hello,
I have a matrix say VP of size 100 * 106 and I want to add 50 constant values above and 50 values belowhis matrix (50 values on each column above and below) . How can I do it?

採用された回答

Kevin Holly
Kevin Holly 2022 年 11 月 4 日
VP = rand(100,106);
extra50 = rand(50,106);
NewVP = [extra50;VP;extra50];
size(VP)
ans = 1×2
100 106
size(NewVP)
ans = 1×2
200 106
  2 件のコメント
Nisar Ahmed
Nisar Ahmed 2022 年 11 月 6 日
thanks @Kevin Holly, instead of random, how can I use a constant number.
John D'Errico
John D'Errico 2022 年 11 月 6 日
extra50 = repmat(pi,50,106);
or
extra50 = pi*ones(50,106);

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

その他の回答 (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