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
 Column range based on sheet and column indices
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1228 Posts

Posted - 10/26/2022 :  04:15:43 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2022b (64-bit) SR1 9.9.5.167
Windows 7 Pro SP1 x64

Greetings!

I need to define a range based on known sheet and column indices stored in variables.

What is the correct syntax for doing this?

https://www.originlab.com/doc/en/LabTalk/guide/Range-Notation doesn't tell much about this case.

Thank you.

---
Andrey

YimingChen

1683 Posts

Posted - 10/26/2022 :  11:41:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Please try the script:

string wksStr = "Sheet1";
int index = 2;
range rr = %(wksStr$)!$(index);
rr[1]=;



James
Go to Top of Page

AKazak

Russia
1228 Posts

Posted - 10/26/2022 :  12:26:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

Please try the script:

string wksStr = "Sheet1";
int index = 2;
range rr = %(wksStr$)!$(index);
rr[1]=;



James



Dear James,

How do I set range to few columns, say from 2 to end?

---
Andrey
Go to Top of Page

YimingChen

1683 Posts

Posted - 10/26/2022 :  1:46:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
range rr = 2:end;
rnormalize -r 2 irng:=rr;
Go to Top of Page

AKazak

Russia
1228 Posts

Posted - 10/26/2022 :  3:21:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

range rr = 2:end;
rnormalize -r 2 irng:=rr;




Got it.
How do I define rr for a different sheet based on sheet index.
The following syntax doesn't work:
range rr = 3!2:end;


---
Andrey
Go to Top of Page

YimingChen

1683 Posts

Posted - 10/26/2022 :  3:46:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Have you tested the script like below? It worked for me.

range rr = 1!2:end;
rnormalize -r 2 irng:=rr;
Go to Top of Page

AKazak

Russia
1228 Posts

Posted - 10/31/2022 :  04:16:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

Have you tested the script like below? It worked for me.

range rr = 1!2:end;
rnormalize -r 2 irng:=rr;




Works great!
I think it is worth describing "1!2[3]" syntax at https://www.originlab.com/doc/en/LabTalk/guide/Range-Notation.

---
Andrey
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