필터 지우기
필터 지우기

Adding numbers in a row vector

조회 수: 4 (최근 30일)
Ali Fuat Yuvali
Ali Fuat Yuvali 2021년 2월 28일
댓글: Ali Fuat Yuvali 2021년 2월 28일
How can I tell the computer to do this instead of manually typing it?
a = [1,2,3];
alist = [a(1),a(1)+a(2),a(1)+a(2)+a(3)]
Played around with a for loop but it didn't do what I wanted.

채택된 답변

Rik
Rik 2021년 2월 28일
You can do it with a for loop, but you should use cumsum instead.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by