Mathematica 9 is now available

MapIndexed

Usage

MapIndexed[f, expr]f应用到 expr的元素中,并把每个元素的部分指定作为f 的第二个参数给出.
MapIndexed[f, expr, levspec]f应用到由levspec指定的 expr层上的所有部分.


Notes

• 例如: MapIndexed[f,  a, b, c ]LongRightArrow .
• 层指定在A.3.6节中描述.
MapIndexedlevelspec的缺省值为 {1}.
• 例如: MapIndexed[f,   a, b ,  c, d  , Infinity]LongRightArrow .
• 参见 Mathematica 全书: 2.2.4节.
• 同时参见: MapAt.
Further Examples

This applies f to each element in a list, giving the index of the element as a second argument to f.

In[1]:=  

Out[1]=

This applies f to both levels in a matrix.

In[2]:=  

Out[2]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.