Hi Deepak,
Using "sec -p" from within OC will free up Origin for doing other tasks as long as those tasks do not involve compiling Origin C files.
If you want to free up Origin C to compile other files as well, another approach is to push the timer into script code, and call Origin C only for fitting one segment of the data at a time, such as below:
Easwar
OriginLab
//Script code starts here.....
limit(TricData_Time); // Get dataset size
iPts = limit.size;
ii = 0; // point to first row
def TimerProc // Define Procedure for Timer
{
ii++; // move to next row
if(ii > iPts - 9) // if past last segment, turn timer off and quit
{
timer -k;
return;
};
TricLr(ii); // Call OC function that fits one segment
};
timer 5; // Run Timer Procedure once every 5 secs
//
// script code ends here
//
//
//
//
// OC code below:
// please check for accuracy such as data begin/end settings
// note LabTalk counts from 1 and OC from 0
void TricLr(int iBegin)
{
string str;
double dCoeff[4];
int ii;
double data;
Dataset dsB("TricData_Scaler1C0");
Curve crv("TricData_Time","TricData_Scaler1C0");
fitpoly_range(crv, iBegin - 1, iBegin + 8, 2, &dCoeff); // Fit 1nd degree polynomial to entire curve
data = -(dsB[iBegin]/dCoeff[1])/3600000;
str.Format("Life Time %f hours", data);
SetDataDisplayText(str);
}
//
// OC code ends
Edited by - easwar on 07/30/2004 5:06:48 PM