This should work in 7.0 SR4. If you have an X column that shouldn't be included in the row analysis then duplicate the wks and remove the X column first.void smooth_outliers()
{
Worksheet wks = Project.ActiveLayer();
matrix mm;
mm.CopyFromWks(wks);
Dataset dd;
BasicStats bsStat;
double dMin,dMax;
for(int i=0; i<mm.GetNumRows(); i++)
{
mm.GetRow(dd,i);
Data_sum(&dd, &bsStat);
dMin = bsStat.mean - 3*bsStat.sd;
dMax = bsStat.mean + 3*bsStat.sd;
for(int j=0; j<dd.GetSize(); j++)
{
if(dd[j]>dMax || dd[j]<dMin)
dd[j] = bsStat.mean;
}
mm.SetRow(dd,i);
}
for(i=0; i<mm.GetNumCols(); i++);
{
dd.Attach(wks,i);
mm.GetColumn(dd,i);
}
}
...Sorry, since this is the LabTalk forum I should explain how to use that Origin C function.
1. Open CodeBuilder and select File > New.
2. Select C File on the list at left.
3. Check the Add to Workspace and Fill with Default Contents options.
4. Enter a filename and path, then click OK.
5. Scroll to the bottom of your new file, enter a new line and paste the function to the file.
6. Select Tools > Rebuild All to compile.
7. Close CodeBuilder and execute the function by typing smooth_outliers in the script window and pressing Enter.
Mike Buess
Origin WebRing Member
Edited by - Mike Buess on 11/20/2005 7:34:14 PM
Edited by - Mike Buess on 11/21/2005 09:15:14 AM