简体   繁体   English

MATLAB与Mathematica的地图等效吗?

[英]What is the MATLAB equivalent of Mathematica's Map?

The Mathematica code is as follows: Mathematica代码如下:

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? 如何使用类似的方法在MATLAB中实现此表达式?

I don't know if it's still relevant, but it looks like you are searching for the arrayfun() function: 我不知道它是否仍然arrayfun() ,但是看起来您正在搜索arrayfun()函数:

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

Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM