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
 How to get cell data type and distinguish same %1?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hkkim

Republic of Korea
35 Posts

Posted - 10/04/2012 :  03:59:49 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8.1 SR3
Operating System: Windows XP


1) I want to know the data type(string or numeric) of a worksheet cell when it has some data. Is there any function or method to get a cell data type? I wonder the '...' part in a script below.

2) Is there any method to distinguish argument "%1" in DOS command and macro call in LabTalk?

Thank you!
hkkim

----------------------------------------------------------------------
...
for(ii=1; ii<=100; ii++)
{
// This will terminate the loop early if true
if (Cell(ii,1)$ > "end") break;
if (Cell(ii,1)$ == 'string') && (Cell(ii,2) == 'numeric')) macroA ii // macro call with a row number
}
...
----------------------------------------------------------------------

Drbobshepherd

USA
Posts

Posted - 10/04/2012 :  11:30:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hkkim,

You can write an if statement to test for type string. For example:

if(cell(3,2)==(1/0)) type "String";else type "Numeric";

Actually, this statement is testing for NAN, but by process of elimination, if the cell value is not a number, it must be a string.

DrBob
Go to Top of Page

hkkim

Republic of Korea
35 Posts

Posted - 10/05/2012 :  04:50:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, DrBob,
Thank you for your help! My script works well now!
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