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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given 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

23 correct solutions
12 incorrect solutions

Last solution submitted on Apr 04, 2015

1 player likes this problem

1 player likes this solution

4 players like this solution

3 Comments

Khaled Hamed
on 24 Jan 2013

Perfect! :)

Freddy
on 24 Jan 2013

And again, Alfonso beats us all. Well done.

Alfonso Nieto-Castanon
on 24 Jan 2013

Ha... Obi-wan, become matlab you must... :)

1 player likes 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.

2 Comments