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 for Programming
 LabTalk Forum
 Deleting the first row of every new value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jfriday09

USA
4 Posts

Posted - 08/12/2019 :  4:30:15 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Posted - 08/12/2019 :  9:56:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

wks.deleteRows() method can help:
https://www.originlab.com/doc/LabTalk/guide/Basic-Worksheet-Column-Operation#Insert_or_Delete_Rows_in_Columns

Regards,
Yuki
Originlab
Go to Top of Page

jfriday09

USA
4 Posts

Posted - 08/13/2019 :  7:13:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

yuki_wu

896 Posts

Posted - 08/13/2019 :  10:29:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

jfriday09

USA
4 Posts

Posted - 08/14/2019 :  10:55:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 08/14/2019 :  2:50:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

jfriday09

USA
4 Posts

Posted - 08/20/2019 :  10:27:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 08/20/2019 :  1:03:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 08/20/2019 :  1:11:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Or
wreducerows method:=missing;
If you'd like to run labtalk.

Nikolay
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