Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 171886

Submitted on 3 Dec 2012

Incorrect

20Size
Leading solution size is 18.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
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))
Error: Too many output arguments.
2
Fail
 
%%
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))
Error: Too many output arguments.