T O P I C R E V I E W |
kemcelroy |
Posted - 12/02/2003 : 8:18:17 PM I would like to mask datapoints from within my C code. Here is what I have written:
LT_set_var("c1",i+3); //1 LT_set_var("r1",j+1); //2 LT_set_var("c2",i+3); //3 LT_set_var("r2",j+1); //4 LT_execute("worksheet -s c1 r1 c2 r2"); //5 LT_execute("mark -w1 S2_A"); //6
I have tried troubleshooting with this code:
if(<a statement from above>) printf("success");
and all but line 6 read out "success". I have typed the strings from line 5 and 6 into the Worksheet Script window and they worked fine (substituting the correct values for c1, r1, c2, and r2).
Does anyone know a fix for this? |
3 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 12/03/2003 : 5:15:40 PM You can also do this...
Worksheet wks("S2"); wks.LT_execute("worksheet -s c1 r1 c2 r2");
or
LT_execute("win -o S2 {worksheet -s c1 r1 c2 r2}");
The LabTalk win -o command activates the named worksheet only for the purpose of running the bracketed script. The worksheet is never actually brought to the front. wks.LT_execute() does the same thing.
Mike Buess Origin WebRing Member |
kemcelroy |
Posted - 12/03/2003 : 1:31:32 PM Thank you. I activated the S2 worksheet with this code:
LT_execute("window -a S2");
and now the rest of the code works. |
Mike Buess |
Posted - 12/03/2003 : 12:19:05 AM Your code works fine for me in Origin 7 SR4. Are you taking into account the fact that indices are 0 based in Origin C and 1 based in LabTalk?
void test(int i, int j) { LT_set_var("c1",i+3); LT_set_var("r1",j+1); LT_set_var("c2",i+3); LT_set_var("r2",j+1); LT_execute("worksheet -s c1 r1 c2 r2"); LT_execute("mark -w1 %H_A"); }
test 0 0; // masks cell at row 1, col 3 in active worksheet
...One possible reason that your code doesn't work is that the wks S2 isn't active when the "worksheet -s" command executes.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 12/03/2003 12:20:16 AM
Edited by - Mike Buess on 12/03/2003 12:33:31 AM |
|
|