Cody

# Problem 703. Usage of varargout

Solution 160410

Submitted on 11 Nov 2012 by Jean-Marie Sainthillier
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
%% n=5; [m_out{1:n}] = use_varargout(n) Pass=true; for i=1:n Pass=Pass && isequal(m_out{i},magic(i)); end m_out{n} assert(isequal(Pass,1))

m_out = Columns 1 through 4 [1] [2x2 double] [3x3 double] [4x4 double] Column 5 [5x5 double] ans = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9

2   Pass
%% n=7; [m_out{1:n}] = use_varargout(n) Pass=true; for i=1:n Pass=Pass && isequal(m_out{i},magic(i)); end m_out{n} assert(isequal(Pass,1))

m_out = Columns 1 through 4 [1] [2x2 double] [3x3 double] [4x4 double] Columns 5 through 7 [5x5 double] [6x6 double] [7x7 double] ans = 30 39 48 1 10 19 28 38 47 7 9 18 27 29 46 6 8 17 26 35 37 5 14 16 25 34 36 45 13 15 24 33 42 44 4 21 23 32 41 43 3 12 22 31 40 49 2 11 20