Cody

# Problem 830. Fill a zeros matrix

Solution 2009016

Submitted on 8 Nov 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
value = -13; row = 2; col = 3; B = [0 0 0 0 0 -13]; assert(isequal(your_fcn_name(value,row,col),B)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'zeros')),'zeros forbidden') assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'repmat')),'repmat forbidden') assert(isempty(strfind(filetext, 'ones')),'ones forbidden') assert(isempty(strfind(filetext, 'while')),'while forbidden') assert(isempty(strfind(filetext, 'sparse')),'sparse forbidden')

B = 0 0 0 0 0 -13

for forbidden

2   Fail
value = 2012; row = [ 2 3 3 5 ]; col = [ 1 1 4 4 ]; C = [ 0 0 0 0 2012 0 0 0 2012 0 0 2012 0 0 0 0 0 0 0 2012]; assert(isequal(your_fcn_name(value,row,col),C)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'zeros')),'zeros forbidden') assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'repmat')),'repmat forbidden') assert(isempty(strfind(filetext, 'ones')),'ones forbidden') assert(isempty(strfind(filetext, 'while')),'while forbidden') assert(isempty(strfind(filetext, 'sparse')),'sparse forbidden')

B = 0 2012 B = 0 2012 2012 B = 0 0 0 0 2012 0 0 0 2012 0 0 2012 B = 0 0 0 0 2012 0 0 0 2012 0 0 2012 0 0 0 0 0 0 0 2012

for forbidden

3   Fail
I = [ 2 3 3 5 1 4 9 2 3 9 ]; J = [ 1 1 4 4 5 5 6 8 8 9 ]; assert(isequal(your_fcn_name(0,I,J),zeros(9))) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'zeros')),'zeros forbidden') assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'repmat')),'repmat forbidden') assert(isempty(strfind(filetext, 'ones')),'ones forbidden') assert(isempty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 0 0 0 0 0 0 0 0 0 1 0 0 1]; assert(isequal(your_fcn_name(1,L,M),sol)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'zeros')),'zeros forbidden') assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'repmat')),'repmat forbidden') assert(isempty(strfind(filetext, 'ones')),'ones forbidden') assert(isempty(strfind(filetext, 'while')),'while forbidden') assert(isempty(strfind(filetext, 'sparse')),'sparse forbidden')

B = 0 1 B = 0 1 1 B = 0 0 0 0 1 0 0 0 1 0 0 1 B = 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 B = 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 B = 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 0 B = 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 B = 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 B = 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 B = 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1

for forbidden

5   Fail
I = [ 2 3 3 5 1 4 9 2 3 9 ]; J = [ 1 1 4 4 5 5 6 8 8 9 ]; Z=[ 0 0 0 0 1999 0 0 0 0 1999 0 0 0 0 0 0 1999 0 1999 0 0 1999 0 0 0 1999 0 0 0 0 0 1999 0 0 0 0 0 0 0 1999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1999 0 0 1999 ]; assert(isequal(your_fcn_name(1999,I,J),Z)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'zeros')),'zeros forbidden') assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'repmat')),'repmat forbidden') assert(isempty(strfind(filetext, 'ones')),'ones forbidden') assert(isempty(strfind(filetext, 'while')),'while forbidden') assert(isempty(strfind(filetext, 'sparse')),'sparse forbidden')

B = 0 1999 B = 0 1999 1999 B = 0 0 0 0 1999 0 0 0 1999 0 0 1999 B = 0 0 0 0 1999 0 0 0 1999 0 0 1999 0 0 0 0 0 0 0 1999 B = 0 0 0 0 1999 1999 0 0 0 0 1999 0 0 1999 0 0 0 0 0 0 0 0 0 1999 0 B = 0 0 0 0 1999 1999 0 0 0 0 1999 0 0 1999 0 0 0 0 0 1999 0 0 0 1999 0 B = 0 0 0 0 1999 0 1999 0 0 0 0 0 1999 0 0 1999 0 0 0 0 0 0 1999 0 0 0 0 1999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1999 B = 0 0 0 0 1999 0 0 0 1999 0 0 0 0 0 0 1999 1999 0 0 1999 0 0 0 0 0 0 0 0 1999 0 0 0 0 0 0 1999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1999 0 0 B = 0 0 0 0 1999 0 0 0 1999 0 0 0 0 0 0 1999 1999 0 0 1999 0 0 0 1999 0 0 0 0 1999 0 0 0 0 0 0 1999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1999 0 0 B = 0 0 0 0 1999 0 0 0 0 1999 0 0 0 0 0 0 1999 0 1999 0 0 1999 0 0 0 1999 0 0 0 0 0 1999 0 0 0 0 0 0 0 1999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1999 0 0 1999

for forbidden