fork download
  1. f = @(a, b, c) arrayfun(@(d, e, f) sum([d e f]), a, b, c);
  2. g = @(a, b, c) a + b + c;
  3. f(1:3, 4:6, 7:9)
  4. g(1:3, 4:6, 7:9)
  5. f = @(a, b, c) arrayfun(@(d, e, f) d * e / f, a, b, c);
  6. g = @(a, b, c) a .* b ./ c;
  7. f(1:3, 4:6, 7:9)
  8. g(1:3, 4:6, 7:9)
Success #stdin #stdout 0.36s 411712KB
stdin
Standard input is empty
stdout
ans =

   12   15   18

ans =

   12   15   18

ans =

   0.57143   1.25000   2.00000

ans =

   0.57143   1.25000   2.00000