Cody

Problem 45173. Create the flag of Ramumbia

Solution 2897510

Submitted on 1 Sep 2020
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
L = 1; W=3; y_correct(:,:,1) = [1,0,0]; y_correct(:,:,2) = [0,1,0]; y_correct(:,:,3) = [0,0,1]; assert(isequal(RamumbiaFlag(L,W),y_correct))

2   Pass
L = 3; W = 8; y_correct = zeros(L,W,3); assert(isequal(RamumbiaFlag(L,W),y_correct))

3   Fail
L = 10; W = 27; y_correct(:,:,1) = [ones(10,9),zeros(10,9),zeros(10,9)]; y_correct(:,:,2) = [zeros(10,9),ones(10,9),zeros(10,9)]]; y_correct(:,:,3) = [zeros(10,9),zeros(10,9),ones(10,9)]]; assert(isequal(RamumbiaFlag(L,W),y_correct))

Error: File: Test3.m Line: 3 Column: 56 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

4   Fail
L = 1000; W = 1211119; y_correct = zeros(L,W,3); assert(isequal(RamumbiaFlag(L,W),y_correct))

Error using zeros Requested 1000x1211119x3 (27.1GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. Error in Test4 (line 2) y_correct = zeros(L,W,3);

5   Fail
L = 100; W = 999; y_correct(:,:,1) = [ones(100,333),zeros(100,333),zeros(100,333)]; y_correct(:,:,2) = [zeros(100,333),ones(100,333),zeros(100,333)]]; y_correct(:,:,3) = [zeros(100,333),zeros(100,333,ones(100,333)]]; assert(isequal(RamumbiaFlag(L,W),y_correct))

Error: File: Test5.m Line: 3 Column: 65 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

Suggested Problems

More from this Author3

Community Treasure Hunt

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

Start Hunting!