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
 Can not get mark to work
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kemcelroy

USA
13 Posts

Posted - 12/02/2003 :  8:18:17 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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?

Mike Buess

USA
3037 Posts

Posted - 12/03/2003 :  12:19:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

kemcelroy

USA
13 Posts

Posted - 12/03/2003 :  1:31:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you. I activated the S2 worksheet with this code:

LT_execute("window -a S2");

and now the rest of the code works.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 12/03/2003 :  5:15:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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