XYSetFilterFunctionsΒΆ

XYSetFilterFunctions sets one or more filter functions for a 2D dataset.

bool = XYSetFilterFunctions(hData, ssFilterFunctions)
bool = XYSetFilterFunctions(hData, ssFilterFunctions, bUpdate)

Return Value

bool is TRUE (1), when the function succeeds and FALSE (0), if it does not.

Parameters

hData

The handle of a dataset created with XYCreate or TYCreate.

ssFilterFunctions

ssFilterFunctions is a string with filter functions. The functions are separated by a semicolon (;), see example.

bUpdate

If bUpdate = TRUE (1) the filter function will be evaluated and the dataset will display the filtered data. If bUpdate = FALSE (0), only the filter function is set. To start the caluculation the functions XYUseFilter and XYUpdate must be invoked. Default value is TRUE (1).

Example

def test_XYSetFilterFunctions()
{
    x = linspace(0, 2*PI, 1000);
    srand(1);
    h = plot(x , sin(x + rand(1,1000)*0.2));
    hData = h[3];
    XYSetFilterFunctions(hData, "smooth(10);fitspline(1.0);simplify(5)");
}
test_XYSetFilterFunctions();
auto_AddToUI("Examples", "Example", "RS_Example3");
def RS_Example3()
{
    auto_SetFileNameDialogInit("*.asc; *.nc", GetRootDirectory() + "samples/");
    svFile = auto_GetFileNameDialog(3);
    if (svFile[1] == "DLG_CANCEL") {
        return;
    }
    NumberOfFiles = len(svFile);
    hPage = auto_LoadTemplate("example");
    for (i in 1:NumberOfFiles) {
        svFile[i] = auto_ImportData(svFile[i]);
        hData = auto_LoadDataset("Diagramm 1", "rpm", "torque");
        XYSetFilterFunctions(hData, "akimaspline()");
        hData = auto_LoadDataset("Diagramm 2", "rpm", "power");
        XYSetFilterFunctions(hData, "akimaspline()");
    }
    auto_ScaleAxes();
    auto_ReplaceTextDialog(svFile[1]);
    auto_UpdatePage();
}

Comment

For a list of filter functions see Filter Functions for XY datasets.To specify the filter interactively choose Data=>1D and 2D Dataset.

id-1132714