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
 possible two-pair combination of cels
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

aboateng

USA
4 Posts

Posted - 10/29/2012 :  12:06:18 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0
Operating System: Windows 7

I have spectral dataset and I want to write a script to compute a two-pair combination of all cells in each column and the use the resulting pairs to calculate an index in the form:(a2-a1)/(a2+a1). I want the script to loop through column i to column n.

Thanks in advance for your help

Kathy_Wang

China
159 Posts

Posted - 11/01/2012 :  02:04:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I'm not sure about the concept "2-pair combination", would you mind to explain further how this combination looks like, and how you should get the resulting pairs?



Kathy
Originlab
Go to Top of Page

aboateng

USA
4 Posts

Posted - 11/01/2012 :  02:23:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Basically I have a dataset in the form:
a1 b1
a2 b2
a3 b3
a4 b4
etc

I want a script that will loop through the data starting at column "a" and calculate: (a2-a1)/(a2+a1), (a2-a3)/(a2+a3), (a2-a4)/(a2+a4), (a3-a4)/(a3+a4). so when it has gone through all the cells in this column, then it moves to the next column and repeat the process.

thank you

quote:
Originally posted by Kathy_Wang

Hi,

I'm not sure about the concept "2-pair combination", would you mind to explain further how this combination looks like, and how you should get the resulting pairs?



Kathy
Originlab

Go to Top of Page

Penn

China
644 Posts

Posted - 11/01/2012 :  11:28:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please refer to

int ncols = wks.ncols;  // get the number of columns
for(ii=1; ii<=ncols; ii++)  // loop all columns in the worksheet
{
	wks.addcol();  // add a new column for the result
	for(jj=1; jj<wks.maxrows; jj++)  // loop all rows in the column
	{
		wcol(ncols+ii)[jj] = (wcol(ii)[jj+1]-wcol(ii)[jj])/(wcol(ii)[jj+1]+wcol(ii)[jj]);
	}
}


Penn
Go to Top of Page

aboateng

USA
4 Posts

Posted - 11/02/2012 :  12:11:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Penn

quote:
Originally posted by Penn

Hi,

Please refer to

int ncols = wks.ncols;  // get the number of columns
for(ii=1; ii<=ncols; ii++)  // loop all columns in the worksheet
{
	wks.addcol();  // add a new column for the result
	for(jj=1; jj<wks.maxrows; jj++)  // loop all rows in the column
	{
		wcol(ncols+ii)[jj] = (wcol(ii)[jj+1]-wcol(ii)[jj])/(wcol(ii)[jj+1]+wcol(ii)[jj]);
	}
}


Penn

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