Cody

Problem 46716. Matrix with increasing numbers (★★★★)

Solution 3938348

Submitted on 1 Dec 2020 by Akrem Hadji
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
m = 3; n = 4; Z_correct = [1 2 3 4; 5 6 7 8; 9 10 11 12]; assert(isequal(your_fcn_name(m,n),Z_correct))

v = 2.7183 7.3891 20.0855 54.5982 w = 1.0e+03 * 0.0010 0.0546 2.9810 Z = 1 2 3 4 5 6 7 8 9 10 11 12

2   Pass
m = 2; n = 5; Z_correct = [1 2 3 4 5; 6 7 8 9 10]; assert(isequal(your_fcn_name(m,n),Z_correct))

v = 2.7183 7.3891 20.0855 54.5982 148.4132 w = 1.0000 148.4132 Z = 1 2 3 4 5 6 7 8 9 10

3   Pass
m = 1; n = 8; Z_correct = [1 2 3 4 5 6 7 8]; assert(isequal(your_fcn_name(m,n),Z_correct))

v = 1.0e+03 * 0.0027 0.0074 0.0201 0.0546 0.1484 0.4034 1.0966 2.9810 w = 1 Z = 1 2 3 4 5 6 7 8

4   Pass
m = 5; n = 1; Z_correct = [1 2 3 4 5]'; assert(isequal(your_fcn_name(m,n),Z_correct))

v = 2.7183 w = 1.0000 2.7183 7.3891 20.0855 54.5982 Z = 1 2 3 4 5

5   Pass
filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'for')),'for forbidden') assert(isempty(strfind(filetext, 'while')),'while forbidden') assert(isempty(strfind(filetext, 'reshape')),'reshape forbidden')