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
 Making a script more versatile
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

MbelairB

5 Posts

Posted - 05/12/2023 :  11:35:57 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2021
9.8.0.200
Windows 10 Pro

Hi all

So....I am working on a custom analysis template. To start off, I have a set of multiple xy data, which are being normalized and stored in a new sheet. In the original sheet (let's call it rawData) there is also a user parameter which serves as a cut off. This is an individual number for each y-value.

For my further analysis, I wanted to make a new sheet which only copies the normalized data beyond the cut off point. So if I had for instance 5k data points and my cut off is 2k, only the last 3k values should be transferred to the new sheet.

So far, my approach was a short lab-talk script, which I implemented into the first column via the "set values" menu:
wrcopy iw:= normalized! c1:=[j] c2:=[j] r1:=rawData!wcol([j])[D"cut off"] dc:=[j] ow:=cropped;


This works exactly as I wanted, but I have to implement it manually into every column on its own. I don't know why, but when I try to change the upper range c2, it will copy data for all columns using only the cut off value of the first column. I am still unexperienced with labtalk, so I don't understand how I could make wrcopy use the cut off for the specific column.
Do I have to write a loop in order to properly cycle through the indivdual values or is there a more elegant variant?

Would like to avoid loops as it is slowing down the data handling quite a lot (tons of data...)

Best regards
Marv

Edited by - MbelairB on 05/12/2023 11:36:24 AM

YimingChen

1593 Posts

Posted - 05/12/2023 :  2:33:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
wrcopy is to copy/paste a block of data in the worksheet, while in your case you need to copy column by column as the starting row varies for each column. You can probably use the Set Multiple Column Values.. See the attached project file. You can highlight all columns in cropped worksheet, select "Set Multiple Column Values" and use the script shown in the figure.

https://my.originlab.com/ftp/forum_and_kbase/Images/setMultipleCols.opju




James

Edited by - YimingChen on 05/12/2023 2:34:15 PM
Go to Top of Page

MbelairB

5 Posts

Posted - 07/04/2023 :  10:52:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much James!

Works like a charm and safed me from days of unnecessary work!

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