title: Applying a function on array that returns outputs with different size in a vectorized manner
body: <p>How to apply a function that returns non scalar output to arrays using <code>arrayfun</code>?</p>
  
  <p><strong>For example</strong> - How to vectorize the following code?</p>
  
  <pre><code>array = magic(5);
  A = cell(size(array));
  for i=1:5
      for j=1:5
        A{i,j} = 1:array(i,j);
      end
  end
  </code></pre>
  
  <p>This naive attempt to vectorize does not work, because the output is not a scalar</p>
  
  <pre><code>array = magic(5);
  result = arrayfun(@(x)(1:x),array);
  </code></pre>