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
 Extract data from worksheet with rounding
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Talku

2 Posts

Posted - 11/14/2017 :  10:26:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
I do not have experience in Origin, so I hope I can explain my problem:
I want to extract data from a worksheet. Column A is the time, column B a measurement value, and column C the status of the measurement equipment.
The task is: If the value in column C changes to 50, look at the time in column B (lets say for instance its 321.3). Search in column B for the closest value to "two seconds later" (321.3 + 2 = 323.3) and extract the row (columns A and B) into a second worksheet.

Up to now, two measurements, i.e. one row, were apart exactly 0.1 seconds. So when the value in C became 50, I just extracted the row 20 rows below (because 20 rows later equals 2 seconds). I did this with the "extract data from worksheet" dialog.
Now the measurement frequency is not constant anymore, i.e. sometimes it takes 0.1 seconds, sometimes 0.3 seconds between to measurements, so I cant use the number of rows to search for the value 2 seconds later.
Moreover, this means that sometimes I do not have a datapoint exactly two seconds later, but 1.8 seconds or 2.1 seconds. So I have to find the closest value to 2 seconds.

Thank you for your Help!

yuki_wu

896 Posts

Posted - 11/15/2017 :  10:22:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Worksheet Query dialog is still available for this:

1. Select Worksheet: Worksheet Query from menu to open Worksheet Query dialog box
2. Select Scripts: Edit from the dialog menu
3. Type the scripts inside the Script Before If Condition box:

if(col(C)[i]== 50)
{
dd = col(B)[i]
}

4. Click OK button
5. Select Column(B) in the left panel and then click => button to make this column available in Select Column Variables for If Test panel for constructing the condition.
6. Enter the following condition formula in the Condition box:

abs(col(B)-(dd + 2)) == min(abs(col(B)-(dd + 2)))

7. Select Extract to New Worksheet in the Output item
8. Click OKbutton



Hope it helps.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 11/15/2017 10:27:49 PM
Go to Top of Page

Talku

2 Posts

Posted - 11/16/2017 :  09:42:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Yuki!
I think this is exactly what I have searched for. I will try your idea tomorrow on a new measurement.
Have a nice day
Best regards
Talku
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