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
 Failed to resolve range string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ano32

4 Posts

Posted - 10/24/2016 :  04:54:22 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8 SR0
v8.0725 (B725)
win10

Hello!

I have 140 columns with 1024 rows and would like to copy rows 570 to 770 of each column to different sheet. I use this "script" in the script window next to the workbook:

loop (ii, 2, 141){copydata irng:=[book4]sheet!col(ii)[570:770] orng:=[book4]copied;};

But this error occurs:

Failed to resolve range string, VarName = irng, VarValue = [book4]sheet!col(ii)[570:770]

Please help.

Best regards Ondřej Cibulka

yuki_wu

896 Posts

Posted - 10/24/2016 :  05:38:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can try the following script:

loop (ii, 2, 141){copydata irng:=[book4]sheet1!col($(ii))[570:770] orng:=<new>!<new>;}

Hope it works.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 10/24/2016 05:38:50 AM
Go to Top of Page

ano32

4 Posts

Posted - 10/24/2016 :  09:49:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you. It do not work, the error is still the same:

Failed to resolve range string, VarName = irng, VarValue = [book4]sheet1!col(1)[570:770]

Only difference is that the number in brackets after col() changes after start number in loop function.

Is the problem connected with data in the sheet? I have Czech version of Win10 and Origin uses , instead of . in numbers (3,1415). But graphs and all other computation are OK.
Go to Top of Page

yuki_wu

896 Posts

Posted - 10/24/2016 :  10:56:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

At first, I don’t think your Czech version is a problem.

In order to illustrate more clearly, let me take a simple example:
There are 5 columns in my data, and I want copy each row 15-20 of column 2-5 to a new worksheet respectively.

1. Check the name of workbook and worksheet that should point to your data correctly in the script.


2. Run the script to see if it can be successful to copy only one column to a new worksheet

copydata irng:=[book1]sheet1!col(2)[15:20] orng:=<new>!<new>;



3. Need to loop over the columns now, please go to this page and find out how to loop the columns:
http://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs#Looping_over_Columns_and_Rows

loop (ii, 2, 5){copydata irng:=[book1]sheet1!col($(ii))[15:20] orng:=<new>!<new>;}

Note that $ should be added in col() of a loop



BTW, I have a small tip. If you want to know more about copydata, you can type “copydata -d” and hit ENTER in Command window. A dialog will be brought up. You can specify the input and output in the flyout by clicking the triangle button. At last, you select the triangle button at the top and select Generate Script, you can see the script shows on the Command window.


Hope this can be some help.

Regards,
Yuki
OriginLab
Go to Top of Page

ano32

4 Posts

Posted - 10/26/2016 :  04:19:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much for your help. I replay your example in my Origin document and it did not work (error "Fail to copy data range" occured). But when I tried it in new Origin document, it works! So I will try manipulation with my data in a new file and I will give you a feedback.

Thank you again. Ondřej
Go to Top of Page

ano32

4 Posts

Posted - 11/11/2016 :  05:56:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello!

Thank you very much for your help. I try to program my script in new Origin file and it works now!

Best regards Ondřej
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