T O P I C R E V I E W |
willsand |
Posted - 10/30/2014 : 3:04:44 PM Origin Ver. 9.1 (64bit) Sr1 Operating System:Windows 7
Hello,
I have a dataset that has ~300 columns of data and would like to average every 3 columns. I know that with brute force I could just do something like
=(Col(A2)+Col(A3)+Col(A4))/3 rinse and repeat
Given the vast amount of time it would take to input all of the different column assignments, I imagine it would be easier to write a script that averages the first three Y Column values and then have this process loop to the next three column values and so on. It would be great if origin has the ability to create a new workbook that contains only the averaged column values as well. I have looked through the LabTalk manual on averaging multiple curves but cannot seem to grasp how to write the script I need. Thank you to anyone that can help me with this! |
1 L A T E S T R E P L I E S (Newest First) |
greg |
Posted - 10/31/2014 : 12:32:00 PM Something like this:
range raSh = !; newbook name:=Results; range raCols = 1, raMeans = 2; for(ii = 2, row = 1 ; ii <= raSh.ncols ; ii += 3, row++) { first = ii; last = ii + 2; if(last > raSh.ncols) last = raSh.ncols; range raC = %(raSh)($(first):$(last)); stats ix:=raC mean:=vMean; raCols[row]$ = $(first) to $(last); raMeans[row] = vMean; }
|
|
|