Cody

# Problem 830. Fill a zeros matrix

Solution 614640

Submitted on 9 Apr 2015 by nhagen
• Size: 9
• This is the leading solution.
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   Pass
%% Test first example 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')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name (line 2) In evaluateCode', '/users/mss.system.DSjLXW/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

2   Pass
%% Test second example 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')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name (line 2) In evaluateCode', '/users/mss.system.DSjLXW/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

3   Pass
%% zeros 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(strfind(filetext, 'while')),'while forbidden') assert(isempty(strfind(filetext, 'sparse')),'sparse forbidden')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name (line 2) In evaluateCode', '/users/mss.system.DSjLXW/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

4   Pass
%% another one L = [ 2 3 3 5 1 4 9 2 3 9 ]; M = [ 1 1 4 4 5 5 6 8 8 9 ]; sol =[ 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]; 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')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name (line 2) In evaluateCode', '/users/mss.system.DSjLXW/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

5   Pass
%% Last example 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')

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In your_fcn_name (line 2) In evaluateCode', '/users/mss.system.DSjLXW/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]