Clear Filters
Clear Filters

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

1 view (last 30 days)
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?

Accepted Answer

Kevin Holly
Kevin Holly on 4 Nov 2022
VP = rand(100,106);
extra50 = rand(50,106);
NewVP = [extra50;VP;extra50];
ans = 1×2
100 106
ans = 1×2
200 106

More Answers (0)


Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!