2.1.17.2.8.1 curve_stats
Description
compute descriptive statistics on a curve between two X markers, by index in the curve
compute descriptive statistics on a data range, and output to tree.
compute descriptive statistics on points provided as two vectors, and output to tree.
Syntax
bool curve_stats( double x1, double x2, DWORD dwCntrl, DataPlot & dataplot = NULL )
bool curve_stats( const DataRange & dr, TreeNode & tr )
bool curve_stats( const vector & vx, const vector & vy, TreeNode & tr )
Parameters
- x1
- [input] left marker position
- x2
- [input] right marker position
- dwCntrl
- [input] option reference to
- enum {
- CUVS_X_MARKERS_NEAREST = 0x1000, // consider data nearest to x, if not set, then consider data between but exclude markers
- CUVS_DUMP_SCRIPTWIN = 0x2000, // if set, then output to script window
- };
- dataplot
- [input] the plot to do the calculation from, if NULL, will use the active curve in the active layer
- dr
- [input] data range object contains data selection to do descriptive statistics
- tr
- [output] the tree to get statistics result
- vx
- [input] vector containing X-coordinates of the points
- vy
- [input] vector containing Y-coordinates of the points
- tr
- [output] the tree to get statistics result
Return
false if no curve found
false if dr is invalid
Returns true.
Examples
EX1
void curve_stats_ex1()
{
//use active plot and output result to Script Window.
curve_stats(-10, 10, CUVS_DUMP_SCRIPTWIN);
}
EX2
// Before running, make sure one data plot is existed in one active graph window
void curve_stats_ex2()
{
Tree tr;
init_input_data_branch_from_selection(tr, DRR_GET_DEPENDENT); // init tree with X, Y tree nodes from the active data plot
DataRange dr;
dr.Create();
dr.SetTree(tr); //create data range object from tree
Tree trReport;
curve_stats(dr, trReport);
out_tree(trReport);
}
EX3
void curve_stats_ex3()
{
//prepare input data
vector vX, vY;
vX.Data(1, 10, 1); //fill vector with start = 1, end = 10, interval = 1;
vY.Data(0.5, 5.0, 0.5);
Tree trResult;
if( curve_stats(vX, vY, trResult) )
out_tree(trResult);
}
Remark
See Also
Header to Include
origin.h
Reference
|