Hi Darko,
Try the code pasted below.
To learn more Origin C:
1> look at code examples in Programming Help file under Language reference as well as under Programming Guide
2> look at code examples from this page:
http://www.originlab.com/index.aspx?s=9&lm=71&pid=268
3> search the forum for code segments that OriginLab and other users may have posted
Easwar
OriginLab
void remove_bsln()
{
// Point to active worksheet and check validity
Worksheet wksData = Project.ActiveLayer();
if( !wksData ) return;
// Create a temp wks to hold baseline data
WorksheetPage wpgTemp;
wpgTemp.Create("Origin", CREATE_HIDDEN);
Worksheet wksTemp = wpgTemp.Layers(0);
while( wksTemp.DeleteCol(0) );
wksTemp.AddCol("BslnX");
wksTemp.Columns(0).SetType(OKDATAOBJ_DESIGNATION_X);
wksTemp.AddCol("BslnY");
// Point to the LabTalk curve object
using LTCurve = LabTalk.curve;
// Loop over wks assuming the data is organized as XYXYXY...
int nCols = wksData.GetNumCols();
for(int ic = 1; ic < nCols; ic += 2)
{
// Reset the LabTalk curve object
LTCurve.Reset();
// Point to the current Y dataset for input data
LTCurve.Data$ = wksData.Columns(ic).GetDatasetName();
// Get size of input data and set this as size for baseline
Dataset dsData(wksData, ic);
LTCurve.baselinePts = dsData.GetSize();
// Point to temp wks cols 1,2 for baseline output
LTCurve.basex$ = wpgTemp.GetName() + "_" + wksTemp.Columns(0).GetName();
LTCurve.basey$ = wpgTemp.GetName() + "_" + wksTemp.Columns(1).GetName();
// Set baseline type to 0 - End weighted
LTCurve.baseline.fittype = 0;
// Compute baseline
LTCurve.baseline();
// Subtract the baseline from the raw data
Dataset dsBsln(wksTemp, 1);
dsData -= dsBsln;
}
// Destroy the temp worksheet
wpgTemp.Destroy();
}