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
 Shift of x-y Data based on table

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
cheynitz Posted - 04/13/2023 : 04:07:57 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2021pro
Operating System: Win10

Hi everyone,

i have 10 worksheets with each x-y Data in two corresponding columns. In another workbook there is one column with 10 entries, each containing a shift value for the 10 x data-components.

How can i match the 10 shift values to apply for their corresponding x-columns? In an ideal case in every of the 10 worksheets a new column "x-shift" is generated and calculated, based on the shft value.

Thank you
6   L A T E S T    R E P L I E S    (Newest First)
cheynitz Posted - 04/20/2023 : 4:12:02 PM
Great, thank you very much! It works fine and i can comprehend the logic behind it.
snowli Posted - 04/20/2023 : 2:13:10 PM
Yes, if u want to add new column in each sheet with xshift value from another column in another book, u will need to loop through sheet.

U can easily do column calculation by defining range variables for different columns
https://www.originlab.com/doc/en/LabTalk/guide/Range-Notation

Run the following script to add new column on each sheet of book1 and shift x.



range xshift = [book2]Sheet1!A;
ii=1;
doc -e lb //loop through sheets
{
if (%H == "Book1") //only for book1
{
wks.ncols=wks.ncols+1; //add one column
range rA=A; //rA is column A
range rLast = 0; //0 is dynamic ending. here last column
rLast = rA+xshift[$(ii)];
ii++;
}
}

Thanks, Snow
cheynitz Posted - 04/20/2023 : 12:12:18 PM
Hi Snow,
thank you very much for your answer, which i learned a lot from, also indepedent from my question.

In my ideal scenario the calculated x-shift columns are "added" to the existing x-y Worksheets as new columns. This would also call for coding?

Best Christian
snowli Posted - 04/20/2023 : 11:57:33 AM
I think we need to know better where u need the output to. If u want to replace existing A columns, maybe writing script is faster since the script should be simple.
If u just want to put all shifted X in individual columns in a new sheet, u can do the following

Suppose all your worksheets in same book (book1)
I created a new book with X shift values for each sheet in Book2.
Enter formula [book1]$(j-1)!A+A1 in B formula to calculate [book1]1!A column plus A1 value in book2.
Then click on the formula cell. Drag the tiny dot on bottom-right corner of the cell right, or double click the tiny dot to extend formula to the right columns.

It will show the shifted X values for all A sheets. U can also stack them into a new column.

Thanks, Snow
cheynitz Posted - 04/20/2023 : 05:39:42 AM
Thank you very much James! In deed a little disappointing that there is no straight forward option for such an usual task :(
YimingChen Posted - 04/13/2023 : 09:02:14 AM
It requires LabTalk script to handle this task. It would be helpful if you could share a project file.

James

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