Admin Production ni-theme
Current Publication

Shift

LabWindows/CVI

Shift

Advanced Analysis Library Only

AnalysisLibErrType Shift (double inputArray[], ssize_t numberOfElements, ssize_t numberOfShifts, double outputArray[]);

Purpose

Shifts the elements of the input array a specified number of places using the following formula:

yi = xi – shifts

You can specify the number of shifts to be in the positive (right) or negative (left) direction.

The following example uses the Shift function to shift an array by 20 samples.

double inputData[200], shiftedData[200];
int numShifts;
AnalysisLibErrType status;

numShifts = 20;

// Generate an array of random numbers
status = Uniform (200, 17, inputData);
status = Shift(inputData, 200, numShifts, shiftedData);

Parameters

Input
Name Type Description
inputArray double [] Input array to shift.
numberOfElements ssize_t Number of elements in the input array.
numberOfShifts ssize_t Number of shifts performed on the input array.

If numShifts is positive, the shift is to the right. If numShifts is negative, the shift is to the left. This is not a circular shift. Shift does not retain the shifted values and replaces the trailing portion of the shift with zero.
Output
Name Type Description
outputArray double [] Shifted array.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later