Cody

# Problem 266. Return the Nth Output from an Input Command

Solution 1710332

Submitted on 19 Jan 2019
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
F = {@min, [5 2 3 9 13 4 1 7 8]}; N = 2; assert(isequal(nth_output(F,N),7))

Brace indexing is not supported for variables of this type. Error in nth_output (line 3) varargout=v{N}; Error in Test1 (line 3) assert(isequal(nth_output(F,N),7))

2   Fail
F = {@min, [5 2 3 9 13 4 1 7 8]}; N = 1; assert(isequal(nth_output(F,N),1))

Brace indexing is not supported for variables of this type. Error in nth_output (line 3) varargout=v{N}; Error in Test2 (line 3) assert(isequal(nth_output(F,N),1))

3   Fail
F = {@regexp, 'she sells sea shells by the seashore', 's'}; N = [1 4 6]; [a,b,c] = nth_output(F,N); assert(isequal(a,[1 5 9 11 15 20 29 32])) assert(isequal(b,num2cell('ssssssss'))) assert(isequal(c,repmat(struct,1,8)))

Brace indexing is not supported for variables of this type. Error in nth_output (line 3) varargout=v{N}; Error in Test3 (line 3) [a,b,c] = nth_output(F,N);