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

Problem 266. Return the Nth Output from an Input Command

Created by @bmtran

Description

Given F, a cell array whose first element is a function handle and subsequent elements are arguments, return the N th output of that function. When N is a vector, return outputs in the same order as N.

Example

    F = {@min, [5 2 3 9 13 4 1 7 8]}
    N = 2;
    output = nth_output(F,N);
    output = 7
    F = {@min, [5 2 3 9 13 4 1 7 8]}
    N = [2,1]
    [output1 output2] = nth_output(F,N);
    output1 = 7
    output2 = 1

Problem Group

Solution Statistics

58 correct solutions 81 incorrect solutions
Last solution submitted on Nov 19, 2014

Problem Comments

Solution Comments