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
 copy cells with txt data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

coll@inia.

Spain
125 Posts

Posted - 05/16/2011 :  07:54:20 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8 wxp

In the same sheet, I am trying to copy the txt content of a row to other column, in case the numeric value in a contigous row exceeds 2.
However, the following script only works for numeric data in cols 9 and 4, but not with txt(label) columns:

nRows=wks.nRows;
for(ii=1;ii<=nRows;ii++)
if(col($(7))[ii]>2) $(Col($(9))[ii])=$(col($(4))[ii];

How can I refer to txt column data to make it work?

Thanks, julio




Penn

China
644 Posts

Posted - 05/16/2011 :  9:33:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi julio,

Some syntax problems exist in your script. For a number to referred to the column, you don't need to use the $ sign, such as col(7) is OK, but not col($(7)). And to get the string in a cell, the $ sign is needed after the cell range. You can refer to this page for more details about string variable and this page for more information about substitution notation.

Your script can be changed like:

nRows=wks.nRows;
for(ii=1;ii<=nRows;ii++)
{
	if(col(7)[ii]>2)
		col(9)[ii]$ = col(4)[ii]$;
}


Penn
Go to Top of Page

coll@inia.

Spain
125 Posts

Posted - 05/17/2011 :  10:42:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Penn!

It is easy when you see it but not before!!!

I will love to have a book with major commands such as those! Will it come some time?. I bet it will be a best seller!!!

Thanks, julio
Go to Top of Page

EigenGoofy

64 Posts

Posted - 05/17/2011 :  12:07:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If they really plan to print out those syntaxes with examples and publish as a book, then I would like pre-order it.
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/18/2011 :  10:15:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

We have been shipping a LabTalk Scripting Guide with the product from version 8.5.

The material in that guide is available on our wiki site:
http://wiki.originlab.com/~originla/ltwiki/index.php?title=Category:LabTalk_Programming
where there are also additional scripting examples

The guide is available in PDF form here:
http://www.originlab.com/pdfs/Origin85_Documentation/LabTalk_Scripting_Guide.pdf

Easwar
OriginLab
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