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 index number?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

eno

Japan
34 Posts

Posted - 02/15/2005 :  04:25:48 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 02/15/2005 :  07:50:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

eno

Japan
34 Posts

Posted - 02/15/2005 :  7:12:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Much easier!
Thank you.

eno

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