auto_xy_CreateErrorDatasetΒΆ

auto_xy_CreateErrorDataset creates a new 2D dataset with error data.

hData = auto_xy_CreateErrorDataset(hLayer, ssName, rvX, rvY, rvMinusError, rvPlusError)
hData = auto_xy_CreateErrorDatasetEx(hLayer, ncid, svVarName)
hData = auto_xy_CreateErrorDatasetEx(hLayer, ncid, svVarName, oParameter)
hData = auto_xy_CreateErrorDatasetEx(hLayer, ssNCName, svVarName)
hData = auto_xy_CreateErrorDatasetEx(hLayer, ssNCName, svVarName, oParameter)

Return Value

hData is the handle of the new datasets or 0 in case of an error.

Parameters

hLayer

hLayer is the diagram handle (see PageGetLayerHandle).

ssName

ssName is the name of the dataset to be created by XYCreate.

rvX

rvX is a vector with x-coordinates.

rvY

rvY is a vector with y-coordinates.

rvMinusError

rvMinusError is a vector with the negative error values.

rvPlusError

rvPlusError is a vector with the positive error values. The number of values must match the rvMinusError and the number of data points in the dataset.

ncid

ncid is the handle of an NC file, returned by nc_create or nc_open.

ssNCFile

ssNCFile is the name of an NC file.

svVarName

svVarName is a string vector with 4 channel names: ["x", "y", "minusError", "plusError"]. The x, y, minus and plus errors will be read from those channels.

oParameter

oParameter is an object with optional parameters, for example [. bXSort = TRUE ].

Element Name Description Default Value
bXSort Sort by x. FALSE

Comment

The positive error values are added to the data point and the minus error values are subtracted from the data value. An error value of 0 is not displayed. The number of data points is limited to 200,000. The number of error points must match the number of data points in the dataset.

Example

hDoc = DocCreate();
hPage = PageCreate();
hLayer = LayerCreate();
DocAddPage(hDoc, hPage);
PageAddLayer(hPage, hLayer);

rvX = [1, 2, 3, 4, 5];
rvY = [3, 5, 4, 6, 5];
rvMErr = [0.3, 0.4, 0.5, 0, 0.7];  // minus error
rvPErr = [0.2, 0.5, 0, 0.6, 0.3];  // plus error

hData = auto_xy_CreateErrorDataset(hLayer, "Test", rvX, rvY, rvMErr, rvPErr);
LayerAutoScale(hLayer);

rvConfig = XYGetErrorbarConfig(hData, "Y");
PenSetColor(rvConfig[1], [255,0,0]) // red
PenSetWidth(rvConfig[1], 5) // line width
rvConfig[2] = 5; // line width
rvConfig[3] = 0.3; // width in cm
XYSetErrorbarConfig(hData, "Y", rvConfig);

History

Version Description
R2018.1 New.

id-999724