Author |
Topic  |
|
elirosen
USA
Posts |
Posted - 05/12/2006 : 10:30:21 AM
|
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
|
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 |
 |
|
elirosen
USA
Posts |
Posted - 05/12/2006 : 1:33:50 PM
|
Thank you, Mike. This is really helpful.
Edited by - elirosen on 05/12/2006 1:34:35 PM |
 |
|
|
Topic  |
|
|
|