T O P I C R E V I E W |
pwpelk |
Posted - 10/16/2017 : 05:53:06 AM /Origin 9.1 I want to compute differenc between data in column and write the data to a new column. I use loop and range variable to compute the difference as:
for(i = 1, j = 11; i<6 ; i++; j--) { range Vm=1[i]; range Vp=1[j-1]; Vp-Vm=;
col(3)=(Vp-Vm); }
It computes and displays the difference but not writing data to the column
Please help |
4 L A T E S T R E P L I E S (Newest First) |
pwpelk |
Posted - 10/18/2017 : 08:01:23 AM Dear Aviel,
No it works.
Thanks a lot.
Piotr |
arstern |
Posted - 10/17/2017 : 09:05:36 AM Hi,
I apologize. Please try,
for(ii = 1, jj = 11; ii<6 ; ii++; jj--) { range Vm=1[ii]; range Vp=1[jj-1]; Vp-Vm=;
col(3)[$(ii)]=col(1)[$(jj-1)]-col(1)[$(ii)]; }
Aviel
|
pwpelk |
Posted - 10/17/2017 : 06:23:26 AM Thanks for the suggestion but the script writes not the difference but only every second vaules of the column cells. See below
for(ii = 1, jj = 11; ii<6 ; ii++; jj--) { range Vm=1[ii]; range Vp=1[jj-1]; Vp-Vm=; col(3)[$(ii)]=col(1)[$(jj-1)-$(ii)]; }; For data in col(1) 2 6 10 14 18 22 26 30 34 38 -------------------- It should be Vp-Vm=36 Vp-Vm=28 Vp-Vm=20 Vp-Vm=12 Vp-Vm=4; -------------------- but it gives ; 34 26 18 10 2; It looks as if it picks every second cell value. Please help.
Piotr AGH University |
arstern |
Posted - 10/16/2017 : 3:41:03 PM Hi,
Please try:
for(ii = 1, jj = 11; ii<6 ; ii++; jj--) { col(3)[$(ii)]=col(1)[$(jj-1)-$(ii)]; }
Thanks, Aviel OriginLab |