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];
データから newData を取得するにはどうすればよいですか? 最初の要素を保持してから、これを 2 番目の要素に追加し、これらの組み合わせを 3 番目の要素に追加します。
cumsum関数を試してください:
newData = cumsum(data)