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

Learn moreOpportunities for recent engineering grads.

Apply TodayGiven a function handle, return a handle to a function that would accept an arbitrary number of inputs, applies the function to each input, and returns an arbitrary number of (respective) outputs (<= the number of inputs, of course).

Example:

myf=@(x) det(x);

yourf = flexf(myf);

[a,~,b,c] = yourf([1 2;3 4],7,[1 2 3; 4 5 6; 2 3 1],3,[2 -1 ; 1 -1])

a = -2 b = 9 c = 3

19 correct solutions
11 incorrect solutions

Last solution submitted on Jul 16, 2014

4 players like this solution

2 Comments

Alfonso Nieto-Castanon
on 24 Jan 2013

I often wish 'expand' was part of matlab base, don't you? (http://blogs.mathworks.com/pick/2012/03/02/when-deal-doesnt-work-disperse-2/)

Khaled Hamed
on 24 Jan 2013

I agree. Actually, at first glance I thought it was.

3 Comments