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
 Splitting worksheet into two sheets

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
shashank.vasudevan Posted - 08/12/2016 : 05:27:07 AM
Hello,

I work with RCWA that generates a lot of *.dat files that I process in origin. However, for my current task, i need to split the worksheets into two which I will then process. The worksheets consist of just two columns, one for x axis and one for y axis.

Here is not like just splitting the worksheet from a specific row. For example, the data might look like this:

Col A Col B
1 0
2 10
3 20
4 8
5 0
6 0
7 3
8 15
9 5
10 0
11 0

It is a pattern. It starts from zero, increases to a maximum and decreases to zero for several values and then increases and decreases to zero. However, the range of values for which it is non-zero is not always same. For the above example, zeros appear at row 5. For the next worksheet, it might appear at row 10 and so on. There are several hundreds of rows and several thousands of worksheets.

can someone please help me with splitting the worksheets into two such that one worksheet has values from zero to maximum back to zero. The second worksheet has values from zero to the second set of values and back to zero.
I mean something like:

Worksheet 1
Col A Col B
1 0
2 10
3 20
4 8
5 0

worksheet 2
1 0
2 3
3 15
4 5
5 0
6 0

Thank you.

Regards,
Shashank

Origin Ver. OriginPro 2015G (64-bit) Sr2, b9.2.272 (Lehre)
and Service Release (Select Help-->About Origin):
Operating System:Windows 7 Enterprise, Service Pack 1
3   L A T E S T    R E P L I E S    (Newest First)
shashank.vasudevan Posted - 08/22/2016 : 10:54:18 AM
Hey Jacqueline,

That is awesome. Thank you very much.

Have a great day ahead :)

Best,
Shashank
JacquelineHe Posted - 08/15/2016 : 07:25:44 AM
Hi,

If you want to set the new sheet Column 1 filling with row number, you can add a script (csetvalue formula:="i" col:=1; ) to the above script:


get col(A) -e numpoints; // get number of the row in the dataset
aa=1;

//loop script with decision structures
for(ii=1; ii<=numpoints; ii++)  
{
jj=ii+1;
if (Col(B)[ii]==0 && Col(B)[jj]==0)
{
wrcopy iw:=[book1]sheet1! r1:=aa r2:=ii ow:=<new>;
csetvalue formula:="i" col:=1; //Fill the column 1 with row number
aa=jj;
}
page.active = 1;
}



Thanks
Jacqueline
OriginLab
JacquelineHe Posted - 08/15/2016 : 07:11:04 AM
Hi,

There is a simple tool to split the worksheet as your requirement.
I suggest you can try to use the following Labtalk script.
Copy the script into "Script Window" (Window: Script Window), and highlight all script press "Enter" key.

Then will get the result as the image. I assume the dataset in the Book1 sheet1:


get col(A) -e numpoints; // get the number of the row
aa=1;
for(ii=1; ii<=numpoints; ii++)  
{
jj=ii+1;
if (Col(B)[ii]==0 && Col(B)[jj]==0)
{
wrcopy iw:=[book1]sheet1! r1:=aa r2:=ii ow:=<new>;
aa=jj;
}
page.active = 1;
}





Thanks
Jacqueline
Originlab

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