Labtalk: Diff() function supports padding in the begin or end of range.

Version: 2018

Type: Features

Category: Programming

Subcategory: Labtalk

Jira: ORG-16863

Add optional argument to current function:

vec Diff(vec[,n]) //support length of vector is N

where n can be
0 default, output vector length is N-1
1, pad 0 at the end, output vector length is N
2, pad 0 at the beginning, output vector length is N
3, 1st value in v, diff(v,0), last value in v, output vector length is N+1

For example: Suppose there are 10 rows in column A and Set Column Values of B as

diff(A) – returns 9 numbers. No value in last row.

diff(A,1) – returns 10 numbers. 0 at the end.

diff(A,2) – returns 10 numbers. 0 at the beginning.

diff(A,3) – returns 11 numbers. The begin and ending values are original begin and ending values in A. In between are diff(A) values .