Hi,
Two issues to be paid attention to:
1. Dataset ds1("col4");
I am not sure if you want to get the data in col4 (Column variable in your code). If so, please use
Dataset ds1(col4);
2. col4.SetFormula("col4-bsStat.mean");
Please note that this line is trying to set a formula for the calculation of a column, just like right click on the column, and then select "Set Column Values". It runs LabTalk script in the Set Column Values dialog, so if you put "col4-bsStat.mean" to this dialog, it cannot tell what col4 and bsStat.mean mean. You can change it by constructing a LabTalk script, such as
col4.SetFormula("col(" + col4.GetName() + ") - " + bsStat.mean);
After correcting these two lines, it works.
Penn