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
 All Forums
 Origin Forum
 Origin Forum
 possible two-pair combination of cels

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
aboateng Posted - 10/29/2012 : 12:06:18 PM
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
4   L A T E S T    R E P L I E S    (Newest First)
aboateng Posted - 11/02/2012 : 12:11:43 AM
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

Penn Posted - 11/01/2012 : 11:28:48 PM
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
aboateng Posted - 11/01/2012 : 02:23:37 AM
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

Kathy_Wang Posted - 11/01/2012 : 02:04:49 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000