필터 지우기
필터 지우기

Subtract row from previous row

조회 수: 26 (최근 30일)
C Smyth
C Smyth 2018년 3월 12일
댓글: Farhan Mustafa 2020년 5월 24일
I have a column of data (n long) and I want to subtract each row from the previous. So x = 1 2 6 1 etc
and I want to subtract row 2 from row 1, then row 3 from row 2 ... etc. Ans = -1 -4 5 etc.

채택된 답변

Birdman
Birdman 2018년 3월 12일
x(1:end-1)-x(2:end)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by