Hi Rod,
Setting lower and upper bounds on a dataset also set the display range for that dataset. The data does not get deleted, but only that part of the data is displayed, which corresponds to the last setting of lower and upper bounds.
In order to perform analysis independent of the display settings, you need to make a copy of the data into a vector, such as the code below.
Note that in this code, I first get a copy of the data for the specific rows that I want, and then further I am copying this into a temp dataset. This is because the BasicStats call accepts only a dataset. Instead, you can call the NAG library function which accepts vector, thus avoiding having to copy the vector into a temp dataset. Look at the sample project \Samples\Programming\NAG Summary Stas.OPJ and the associated OC file that is attached to that project, on how to call the NAG function. You can also look directly in the programming help file, under the section
Origin C Language Reference->Global Functions->NAG Functions->NAG Simple Calculations on Statistical Data.
Making a copy of a dataset column into a vector for performing analysis also has other benefits. For example, your source dataset may have missing values. Then in the copy the missing values could be removed using vectorbase methods such as Trim(), TrimLeft(), TrimRight() etc. and then you can process the data that remains.
Easwar
OriginLab
void get_stats()
{
// Declare wks
Worksheet wks = Project.ActiveLayer();
if( !wks ) return;
// Point to 2nd column in current wks
Column ccData( wks, 1 );
if( !ccData ) return;
// Copy rows 10 thru 20 to a vector
vector vecSubData( ccData, 9, 19 );
// Place vector in temp dataset to call basic stats
Dataset dsTemp( vecSubData );
BasicStats bsStatVal;
// Get basic stats
Data_sum(&dsTemp, &bsStatVal);
// Print results
printf( "min, max, mean: %f %f %f\n", bsStatVal.min, bsStatVal.max, bsStatVal.mean );
}