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
 Origin Forum
 find in columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Matrices_stack

5 Posts

Posted - 04/06/2021 :  05:40:28 AM  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:
Origin Pro2018 (64-bit) SR1, b9.5.1.195

Hi guys,
I have a column, that randomly contains three different words. For example:
cat
cat
dog
rabbit

I would like to run a small code (e.g. LabTalk), which gives me "1" for cat, "2" for dog and "3" for rabbit"
cat 1
cat 1
dog 2
rabbit 3

Could you please help me with such a command? I don't know how to deal with words in origin.

Best wishes,
Alisa


YimingChen

1613 Posts

Posted - 04/06/2021 :  09:44:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can copy it to a new column, then:
1. Click the column header, in the pop-up mini toolbar, choose Categorical.
2. Click on the edge of the worksheet, choose Show Category Indices in the worksheet mini toolbar.


The script can be:

colcopy irng:=1 orng:=2;
wks.col2.ISCAT=1;
wks.CATI=1;


James

Edited by - YimingChen on 04/06/2021 09:54:07 AM
Go to Top of Page

Matrices_stack

5 Posts

Posted - 04/06/2021 :  10:27:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

You can copy it to a new column, then:
1. Click the column header, in the pop-up mini toolbar, choose Categorical.
2. Click on the edge of the worksheet, choose Show Category Indices in the worksheet mini toolbar.


The script can be:

colcopy irng:=1 orng:=2;
wks.col2.ISCAT=1;
wks.CATI=1;


James



Thank you for your reply.
I set the column as categorical, but I cannot access the Category Infices.
That probably works for Origin 2020. Unfortunately, I have Origin Pro2018 and don't know how to access the choose Show Category Indices.
Go to Top of Page

YimingChen

1613 Posts

Posted - 04/06/2021 :  10:34:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Try catindex() function to set column value:



James
Go to Top of Page

Matrices_stack

5 Posts

Posted - 04/06/2021 :  10:52:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

Try catindex() function to set column value:



James



No, it does not work as well. It tells this function is unknown:
Go to Top of Page

YimingChen

1613 Posts

Posted - 04/06/2021 :  12:21:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This should work: int(A)
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