The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Insert values of variable to column cells
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

pwpelk

Poland
3 Posts

Posted - 10/16/2017 :  05:53:06 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
/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

arstern

USA
237 Posts

Posted - 10/16/2017 :  3:41:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please try:

for(ii = 1, jj = 11; ii<6 ; ii++; jj--)
{
col(3)[$(ii)]=col(1)[$(jj-1)-$(ii)];
}


Thanks,
Aviel
OriginLab
Go to Top of Page

pwpelk

Poland
3 Posts

Posted - 10/17/2017 :  06:23:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

arstern

USA
237 Posts

Posted - 10/17/2017 :  09:05:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

pwpelk

Poland
3 Posts

Posted - 10/18/2017 :  08:01:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Aviel,

No it works.

Thanks a lot.

Piotr
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000