Enlarge array - MATLAB Cody - MATLAB Central

Problem 1853. Enlarge array

Difficulty:Rate

Given an m-by-n numeric array (A) and a 1-by-2 vector (sz) indicating the dimensions [p q] to enlarge each element, return an (m*p)-by-(n*q) array (B) in which each element of A has been replicated in p rows and q columns.

Example

If

A = [1 2 3
     4 5 6
     7 8 9]
sz = [3 2]

then

B = [1 1 2 2 3 3
     1 1 2 2 3 3
     1 1 2 2 3 3
     4 4 5 5 6 6
     4 4 5 5 6 6
     4 4 5 5 6 6
     7 7 8 8 9 9
     7 7 8 8 9 9
     7 7 8 8 9 9]

Solution Stats

61.54% Correct | 38.46% Incorrect
Last Solution submitted on Oct 30, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...
Dive Into Hands-On Learning at MATLAB EXPO 2025 – Register Now!
Get ready to roll up your sleeves at MATLAB EXPO 2025 –...
2

Problem Recent Solvers285

Suggested Problems

More from this Author44

Problem Tags

Community Treasure Hunt

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

Start Hunting!