Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将向量中的元素添加到先前的元素中。例如:
data = [1,3,5,6,7,9]; newData = [1,4,9,15,22,31];
我如何从数据中获取新数据?我想保留第一个元素,然后将其添加到第二个,将这些组合添加到第三个,依此类推。
试试cumsum函数:
newData = cumsum(data)