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
 How to get index number?

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
eno Posted - 02/15/2005 : 04:25:48 AM
Origin Version (Select Help-->About Origin): 7.5SR5
Operating System: Win 2000SV

Is there any command to get an index number where the
specific data stored? The following is an example.

index,col_a
1,-2.7
2,-2.7
3,-11.6
4,8.8
5,6

If I want to get the index of max data, the following
scripts become too complicated! Especially when the data
length is very long and I have to devide the data using
"set -bs" and "set -es" commands.

sum(data_a);
loop(ii,1,wks.nrows)
{
if(data_a[ii]==sum.max)
{
index=ii;
first=ii;
break;
};
};
type $(index);

eno

2   L A T E S T    R E P L I E S    (Newest First)
eno Posted - 02/15/2005 : 7:12:09 PM
Much easier!
Thank you.

eno

Mike Buess Posted - 02/15/2005 : 07:50:57 AM
In your example you can use the limit command. Following gets the max value and its index in rows 101 to 200...

limit data_a -b 101 -e 200;
ymax=limit.ymax; // max Y value in range
imax=limit.imax; // index of that value

If you want the index for a specific value other than min or max use the list function...

i=list(123.456,data_a);

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/15/2005 08:09:22 AM

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