What is the MATLAB equivalent of Mathematica's Map?

149 Views Asked by At

The Mathematica code is as follows:

In:Map[Function[x, x + 1], {1, 2, 3}]
Out:{2, 3, 4}

How can I use a similar method to realise this expression in MATLAB?

1

There are 1 best solutions below

0
Sebastian Dengler On BEST ANSWER

I don't know if it's still relevant, but it looks like you are searching for the arrayfun() function:

y = arrayfun(@(x) x+1, [1 2 3])

Hope it helps!