Cody

Solution 2677187

Submitted on 10 Jul 2020
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
filetext = fileread('rep_str_2.m'); assert(isempty(strfind(filetext, 'for'))) assert(isempty(strfind(filetext, 'while')))

Assertion failed.

2   Fail
x = 'str_'; num1 = 4; num2 = 10; n = 4; y_correct = {'str_4_10' 'str_5_11' 'str_6_12' 'str_7_13'}; assert(isequal(rep_str_2(x, num1, num2, n),y_correct))

y = [] a = '4' c = '_' b = '10' z = 'str_4_10' y = 'str_4_10' num1 = 5 num2 = 11 a = '5' c = '_' b = '11' z = 'str_5_11' y = 2×8 char array 'str_4_10' 'str_5_11' num1 = 6 num2 = 12 a = '6' c = '_' b = '12' z = 'str_6_12' y = 3×8 char array 'str_4_10' 'str_5_11' 'str_6_12' num1 = 7 num2 = 13 a = '7' c = '_' b = '13' z = 'str_7_13' y = 4×8 char array 'str_4_10' 'str_5_11' 'str_6_12' 'str_7_13' num1 = 8 num2 = 14 z1 = 4×8 char array 'str_4_10' 'str_5_11' 'str_6_12' 'str_7_13'

Assertion failed.

3   Fail
x = 'matstr_'; num1 = 0; num2 = 50; n = 3; y_correct = {'matstr_0_50' 'matstr_1_51' 'matstr_2_52'}; assert(isequal(rep_str_2(x, num1, num2, n),y_correct))

y = [] a = '0' c = '_' b = '50' z = 'matstr_0_50' y = 'matstr_0_50' num1 = 1 num2 = 51 a = '1' c = '_' b = '51' z = 'matstr_1_51' y = 2×11 char array 'matstr_0_50' 'matstr_1_51' num1 = 2 num2 = 52 a = '2' c = '_' b = '52' z = 'matstr_2_52' y = 3×11 char array 'matstr_0_50' 'matstr_1_51' 'matstr_2_52' num1 = 3 num2 = 53 z1 = 3×11 char array 'matstr_0_50' 'matstr_1_51' 'matstr_2_52'

Assertion failed.

4   Fail
x = 'matstr2_'; num1 = 2; num2 = 3; n = 1; y_correct = {'matstr2_2_3'}; assert(isequal(rep_str_2(x, num1, num2, n),y_correct))

y = [] a = '2' c = '_' b = '3' z = 'matstr2_2_3' y = 'matstr2_2_3' num1 = 3 num2 = 4 z1 = 'matstr2_2_3'

Assertion failed.

Suggested Problems

More from this Author59