This function will assemble a large matrix out of a number of smaller ones m1, m2, etc., according to a pattern P. If P is 3x5, then the large matrix will be three times as tall as the small ones, and five times as wide. The small matrices must always have the same dimensions as one another.
The pattern P will be a matrix of integers, each no larger than the number of small matrices provided. Each element in P identifies the small matrix that should be used to fill the corresponding positions in the large matrix. A zero in P indicates that the corresponding patch of the large matrix should be filled with zeros, a 1 indicates it should be filled with m1, etc. Each small matrix may be used more than once, or not at all.
For example, if P = [1 0; 1 2], m1 = eye(2), and m2 = ones(2), then the large matrix M should be
M = 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers111
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2815 Solvers
-
Sum of diagonal of a square matrix
1638 Solvers
-
Back to basics 25 - Valid variable names
339 Solvers
-
Find the maximum number of decimal places in a set of numbers
3458 Solvers
-
MATCH THE STRINGS (2 CHAR) very easy
301 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
get to know varargin because of this problem. Thanks!