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
 Forum for Origin C
 end of range in origin c
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

elirosen

USA
Posts

Posted - 05/12/2006 :  10:30:21 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: win xp

i'd like to know how to use Origin C to evaluate the number of rows in a column that have data. In LabTalk I can use the get -e command to this effect, but I haven't been able to figure out how to do it in Origin C.

I'd really love to know:
1. the origin c command
2. how to assign a LT command to a C variable. I've tried to use
LT_execute("get %(%H,"+ii+")) -e nRows", &nRows); but it hasn't seemed to work.

Many thanks for the help, and also for the invaluable forum.

-Eli

Mike Buess

USA
3037 Posts

Posted - 05/12/2006 :  11:45:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Eli,

1. Use Column::GetUpperBound.
2. You need two commands: LT_execute and LT_get_var.

Following code demonstrates both points. (Takes an OriginC column index as argument.)

void test(int colIndex = 0)
{
Worksheet wks = Project.ActiveLayer();
out_int("lastrow=",wks.Columns(colIndex).GetUpperBound());

colIndex++; // convert to LabTalk index
LT_execute("get %(%H," + colIndex + ") -e nrows");
double nrows;
LT_get_var("nrows",&nrows);
out_int("nrows=",(int) nrows);
}

Mike Buess
Origin WebRing Member
Go to Top of Page

elirosen

USA
Posts

Posted - 05/12/2006 :  1:33:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Mike. This is really helpful.

Edited by - elirosen on 05/12/2006 1:34:35 PM
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