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 for Programming
LabTalk Forum
Conditional Data Extraction into new Columns
Note:
Only the poster of this message, and the Moderator can edit the message.
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Forum:
LabTalk Forum
Subject:
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
Hello everybody! I am totally new to the programming world of OriginPro, which is why I hope to find some help in this LabTalk Forum. Even though this might take some time to read, here's the issue: I have a worksheet with 9 columns and 93.036 rows (rows =i). In order to reduce this data to about 1.000 rows, I want to write a script that extracts certain rows into new columns, depending on wether or not my given conditions are true or false. The conditions depend on 2 columns: the values of one column (let's call it A) go from 0 to 1,0037552E+07, the values of the other column (B) from 0 to 2842,6759. For every of the 93.036 rows there's one value for each column. Here's what I want to achieve with my script: "Whenever the value in Column A is a multiple of 10.000, respectively the first value to be bigger than a multiple of 10.000, extract all the values from this row (i) into 9 NEW columns. BUT whenever the value of Column B reaches 5 or a multiple of 5, then extract this row instead and reset the counter for the 10.000 steps from column A to 0." To make it a little bit clearer, here's an example: Let's say we are in row 500 of our Worksheet(i=500). Therefore, our row "counter" i is set to 500 at the moment. The belonging value in Col(A) is 9999.5, the value in Col(B) is 4.5. The script should not extract any data now, since value(Col(A)[i])!>=n*10000 and value(Col(B)[i])!>m*5. So it needs to jump into the next row (i++). Now i is set to 501, which again, is the row that we are currently in. Here, the value for col(A) is 10.010 and the value for Col(B) is 4.7. Now the script should be able to extract all the values of the 9 given columns in this row into 9 NEW columns, since value(Col(A)[I])>=n*10000. In this case, n was set to 1, since it was the first interval for col(A). Now n needs to go from 1 to 2 (n++). The next time the script should extract a row over the 9 columns, is when either col(A) reaches a value of 20.000 (or the first value bigger than 20.000) OR when the value of col(B) reaches 5 or the first value bigger than 5. Another Example: Let's now say we are in line 2000 (i=2000). The value of col(A) in this row is 16.000, the belonging value of Col(B) is 5.05. In this case, it's the first time for the value of Col(B) to be 5 or bigger (value(Col(B)[i])=>m*5). So the script needs to extract all values over the 9 columns in this row once again, even if the value in col(A) has not reached 20.000 yet. The "counter" for col(A) must now be reset, so that the script doesn't extract the values for value(col(A))=20.000, but for 26.000, because we need to now count 10.000 from the value of col(A) in line 2000, which was 16.000. If the value in col(B) reaches 10 (2*5, next multiple of 5 after m++) earlier than col(A) reaches 26.000, it's the same procedure again. I know this is kind of a tricky topic to discuss on a forum, but since I have no clue how I could possibly program this for Origin, I really hope that there's someone who could help me solve this problem. My main issue is that I'm lacking knowledge on Origin specified commands with loops and general operators, so even if I know the structure behind the program and how it should process each step, there's no chance I could possibly bring this into Origin, but maybe someone can help me out with that. For everyone who made it this far into my post, thank you and I hope to hear from you! [:)] Best regards Origin Ver. and Service Release (Select Help-->About Origin): Operating System: Klapf
Check here to subscribe to this topic.
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000