PDA

查看完整版本 : 考虑到matlab中的索引,如何最好地遍历数组?


poster
2019-12-10, 20:30
我看过这个线程在谈论map: MATLAB中的Map函数? (https://stackoverflow.com/questions/983163/map-function-in-matlab)

结果,我想知道是否有类似的方法可以将这些指标考虑在内。例如,如果我想做类似(x_i)^ i的事情。

非常感谢!



回答:

一个例子:

>> x = randi(10, [1 5]) x = 9 7 4 10 1 >> x.^(1:numel(x)) ans = 9 49 64 10000 1

更多&回答... (https://stackoverflow.com/questions/2307135)