Cody

Problem 43284. Form a square matrix from four square sub-matrices

Solution 1003976

Submitted on 9 Oct 2016 by Atsushi Ueno
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
n=5; x1=1; x2=2; x3=3; x4=4; y_correct = [eye(5) 2*ones(5); 3*ones(5) 4*eye(5)]; assert(isequal(CreateMatrix(n,x1,x2,x3,x4),y_correct))

2   Pass
n=2; x1=5; x2=2; x3=3; x4=-4; y_correct = [5*eye(2) 2*ones(2); 3*ones(2) -4*eye(2)]; assert(isequal(CreateMatrix(n,x1,x2,x3,x4),y_correct))

Suggested Problems

More from this Author37

Community Treasure Hunt

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

Start Hunting!