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
 Find the row number corresponding to a string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Nem

2 Posts

Posted - 05/15/2014 :  06:02:13 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9.1
Operating System: Windows 8

I would like to find the row number associated to a string contained in a column. In other words, I have a column which contains different strings and I would like to find a given string and its associated row number.
This could be done with a 'for' and 'if' iteration, but I thought there was a simple function in LabTalk. I tried with the 'index' and 'xindex' functions, but without success. Any idea?
Thanks!

Castiel

343 Posts

Posted - 05/15/2014 :  11:10:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Nem

Origin Ver. 9.1
Operating System: Windows 8

I would like to find the row number associated to a string contained in a column. In other words, I have a column which contains different strings and I would like to find a given string and its associated row number.
This could be done with a 'for' and 'if' iteration, but I thought there was a simple function in LabTalk. I tried with the 'index' and 'xindex' functions, but without success. Any idea?
Thanks!



    A
1   aa
2   ab
3   ac
4   ac


stringarray sa;
sa.copyfrom(col(A));
sa.find("ab")=;
// sa.find("ab")=2
sa.find("ac")=;
// sa.find("ac")=3





妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
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