Dispatch and collect - MATLAB Cody - MATLAB Central

Problem 2641. Dispatch and collect

Difficulty:Rate

Write a function that dispatches the single argument x to multiple function handles (varargin) and concatenates vertically the respective outputs of these functions. All the functions are guaranteed to return the same numbers of outputs of the same size.

For example, given

x = [1 2 6
     2 7 5 
     3 5 4];
[bounds, positions] = dispatch(x, @min, @max)

bounds and position should be:

bounds = [1 2 4       %first output of min
          3 7 6]      %first output of max
positions = [1 1 3    %second output of min 
             3 2 1]   %second output of max

Solution Stats

54.55% Correct | 45.45% Incorrect
Last Solution submitted on Mar 23, 2023

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
13
5

Problem Recent Solvers14

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page