Author |
Topic  |
|
jfriday09
USA
4 Posts |
Posted - 08/12/2019 : 4:30:15 PM
|
Origin Ver. and Service Release (Select Help-->About Origin): Operating System: Windows 7
Hello, and thank you in advance for any help you can offer. I'm new to origin, and only now looking into LabTalk.
I'm wanting to know if I am able to delete the first row of every new value in a column, and how I can do that.
For instance, in my case, my program gathers 5 rows of data per wavelength or detector position. I can't trust the first row of each new column value, so I want to delete the first row of each value in a given column.
Thanks again. |
|
yuki_wu
896 Posts |
|
jfriday09
USA
4 Posts |
Posted - 08/13/2019 : 7:13:45 PM
|
Hi Yuki!
Thanks for the pointer, it will definitely help. If my program doesn't necessarily generate 5 rows of data consistently, am I still able to delete the first row of a new value in a column? Is labtalk capable of recognizing a new value in a subsequent row in a given column? If not, I may have to make my program more consistent if I'm to use the wks.deleteRows(x, 1); function.
Thanks again. I'm sorry if I'm asking ill informed questions. |
Edited by - jfriday09 on 08/13/2019 7:14:11 PM |
 |
|
yuki_wu
896 Posts |
Posted - 08/13/2019 : 10:29:41 PM
|
Hi,
I think I may be not understand your question fully. Do you want to only delete the first row or delete the first row for every 5 rows?
wks.deleteRows(1) // Delete the first row in all columns
wdelrows del:=1 skip:=4 start:=1; //Start from the first row, then delete 1 row and skip 4 rows Some info about wdelrows X-Function: https://www.originlab.com/doc/X-Function/ref/wdelrows
Regards, Yuki
OriginLab
|
 |
|
jfriday09
USA
4 Posts |
Posted - 08/14/2019 : 10:55:40 AM
|
Hey Yuki,
My program doesn't always produce 5 rows of data per new value in a column. Sometimes it will produce 4 rows, other times it will produce 6 rows. So I'm not able to safely assume I can delete every 6th row.
Sorry if I'm not making sense. Thanks again for taking the time to understand though.
Jacob |
 |
|
cpyang
USA
1406 Posts |
Posted - 08/14/2019 : 2:50:15 PM
|
Are you saying that you have a column to identify the group, like this
123 4543.23 123 4534.12 123 4521.76 124 5432.12 124 5342.67 124 2432.67 124 4323.56
and you want to use delete the row when first column change right?
If that is the case, then you add a new column in your worksheet with formula, assuming col(A) is the grouping value
if(diff(A,2),0/0,1) or
diff(A,2)?0/0:1
or if using labalk code, then you need to write out col(name) like
col(abc)=diff(col(A),2)?0/0:1
then you can delete rows with missing values.
CP
|
 |
|
jfriday09
USA
4 Posts |
Posted - 08/20/2019 : 10:27:40 AM
|
cpyang, thank you! My data would look like that, and you're right on the head with what I'm trying to do. I made a new column with the equations and they point out which are different. That definitely makes my life easier. There isn't a way to have Origin delete those rows for me though, is there?
Thank you so much, you are helping out a ton.
JF |
 |
|
nick_n
Finland
125 Posts |
Posted - 08/20/2019 : 1:03:46 PM
|
Hi,
First of all, remove all recalculation operation (Click on lock: Recalculate None). Menu: WorkSheet\Reduce Rows\Method -> Delete rows with missing values Regards,
Nikolay |
 |
|
nick_n
Finland
125 Posts |
Posted - 08/20/2019 : 1:11:37 PM
|
Or wreducerows method:=missing; If you'd like to run labtalk.
Nikolay |
 |
|
|
Topic  |
|
|
|