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
 before formula script : index value of range
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bedibra

France
35 Posts

Posted - 08/25/2017 :  7:00:57 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear all,
I am looking for a way to get index value of a range of data present in col(A) and put the index values in col(B).
Thanks for the help

nick_n

Finland
125 Posts

Posted - 08/26/2017 :  5:10:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by bedibra

Dear all,
I am looking for a way to get index value of a range of data present in col(A) and put the index values in col(B).
Thanks for the help



Could you describe your problem more? I'm little bit confusing by "index value of a range of data". Probably "list" LT function could help you. http://www.originlab.com/doc/LabTalk/ref/List-func

Nikolay
Go to Top of Page

bedibra

France
35 Posts

Posted - 08/28/2017 :  08:04:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
well, what I want exactly is to get the index value of the LAST row of a column (see picture) in order to use that value for other calculations. any ideas ???


quote:
Originally posted by nick_n

quote:
Originally posted by bedibra

Dear all,
I am looking for a way to get index value of a range of data present in col(A) and put the index values in col(B).
Thanks for the help



Could you describe your problem more? I'm little bit confusing by "index value of a range of data". Probably "list" LT function could help you. http://www.originlab.com/doc/LabTalk/ref/List-func

Nikolay


Edited by - bedibra on 08/28/2017 08:04:56 AM
Go to Top of Page

Chris D

428 Posts

Posted - 08/28/2017 :  10:09:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can use the size of the range that would point to the column. e.g.:

range rCol = col(A);
int nIndex = rCol.GetSize();

nIndex=; // output just for testing.


However, this does not take into account if the last row (or rows) are missing values (--) which can readily happen.
To do that you'd have to do a simple loop backwards until encountering a value in the column that isn't a missing value:

range rCol = col(A);
int nSize = rcol.GetSize();
nIndex = 0;
for (int ii = nSize; ii > 0; ii--)
{
	if (!ISNA(rCol[ii]))
	{
		nIndex = ii;
		break;
	}
}
nIndex=; // output just for testing.


I hope this helps.

Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

bedibra

France
35 Posts

Posted - 08/28/2017 :  6:45:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes this is perfect. thanks
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