# curveedit

Trim, bridge, cut, or replace curves within a given range.

## Syntax

curveedit(operation, X_in, Y_in, start, end, interpolate, expression, flag )

## Input

operation
Math operation performed on a curve:
0 = trim
Removes the data outside of the given range.
1 = bridge
Bridges the curve linearly across the given range. This replaces the data in the selected range with a straight line on a point-by-point basis.
2 = cut
Removes the data within the given range and closes any gap created by this operation.
3 = replace
Uses the expression to calculate new points in which x and y are variables.
X_in
The x vector of the curve data.
Y_in
The y vector of the curve data.
start
Start of the x range.
end
End of the x range.
interpolate
0
The closest point is found in the x vector based on the start/end values that the operation is performed on.
1
A point is inserted using the start or end value in the part of the x vector that the operation is performed on.
expression
Expression is of type string and only used for operation “replace”; for all other operations it is 0. The expression is used to calculate new points in which x and y are variables for the x- and y-vector in the given range.
flag
0
Returns the x vector of the modified curve.
1
Returns the y vector of the modified curve.

## Example

Template Output
Replacing a curve in the range between 37.75 and 125.8 with the expression “5*y”, interpolation on”:
x-vector:
curveedit(3, p2w1c1.x, p2w1c1.y, 37.75, 125.8, 1, "5*y", 0)
y-vector:
curveedit(3, p2w1c1.x, p2w1c1.y, 37.75, 125.8, 1, "5*y", 1)
x- and y- vectors of the modified curve.

## Comment

Use the curveedit function to perform the same math operations as those supported in the HyperGraph Modify Curves panel, and those used in the stackmath operations trim, bridge, cut, and replace.