Origin Ver8.5. and Service Release (Select Help-->About Origin): Operating System:win7
I am trying to make means and sd from several rows (data in col11) in a column according to a common name in another column (col7) by using the following script: for(jj=2; jj<=10; jj++) { if(col(7)[jj]$==col(7)[jj+1]$) {kk = kk + 1;} else {repes = kk; ini = jj - repes + 1; fin = jj; //mean-sd calculation range gen = [Data1]Sheet1!col(11)[$(ini):$(fin)]; sum(gen); col(12)[$(ini):$(fin)]=sum.mean; col(13)[$(ini):$(fin)]=sum.sd; kk = 1; } // end if } //end for
However, I keep getting the following answer (see it down) for the mean-sd calculation, no matter what I do. I guess has something to do with string to numeric value conversion, however it does not take the ini/fin variables without any $(). Invalid dataset index: 2:3 Invalid dataset index: 2:3 Invalid dataset index: 4:6 Invalid dataset index: 4:6 Invalid dataset index: 7:10 Invalid dataset index: 7:10
YES!!! It really made the difference: THAN YOU SO MUCH! I spent hours trying to find out a correct script..... Thank you again Hideo. Here is the final version of the script:
//Initiation range via = [Data1]Sheet1!Col(7); nRows=via.nRows-1; kk = 1;
//from row by row for(jj=2; jj<=nRows; jj++) { if(col(7)[jj]$==col(7)[jj+1]$) {kk = kk + 1;} else {repes = kk; ini = jj - repes + 1; fin = jj;
//mean calculation mean range gen = col(11)[ini:fin]; sum(gen);