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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Find the row number corresponding to a string

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Nem Posted - 05/15/2014 : 06:02:13 AM
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!
1   L A T E S T    R E P L I E S    (Newest First)
Castiel Posted - 05/15/2014 : 11:10:55 AM
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





©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000