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
 Workbook manipulation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bafaneh

USA
49 Posts

Posted - 10/10/2011 :  3:01:03 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1
Operating System:w7

Hi,

I have many miscellaneous questions about how I can change things on the workbook. Please help me with whatever you can from the following questions:

1) How can I label the columns differently and change their number i.e. A1(x) --> 1
2) How can I change the workbook name, worksheet name, and graph name?
3) Is there any way to assign variables to the columns? I want A1(x) assigned to new variable A1 so instead of having code that declares col(1) = col(6)-5, I have colA1(x) = col(6)-5, so if I want to put colA1 to another column, I can simply change A1.

If #3 seems inefficient, or if you have a better idea, please let me know.

Thanks,
Basheer

greg

USA
1379 Posts

Posted - 10/11/2011 :  11:47:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Rename any Window Short Name:
if(!exist(Newname)) window -rename Oldname Newname;
Short Names are alphanumeric, have no spaces and unique

Add Long Name to any window:
range rap = [ShortName];
rap.longname$ = Window Long Name;

Change name of a sheet:
range rawl = [Book1]1!; // point to first sheet (a layer)
rawl.name$ = My First Sheet;

And ranges can be used just like a variable:
range ra = col(a);
range rb = col(b);
range rc = col(c);
range rd = col(d);
rc = ra + 2 * rb;
rd = rc;
Go to Top of Page

bafaneh

USA
49 Posts

Posted - 10/11/2011 :  6:42:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your response.

I got everything to work except the short name code. What is the if(exists) part for? Could you give me an example that should work? I tried substituting newname with "1" and Oldname with "A(x1)" and it did not work.

Thanks.
Go to Top of Page

greg

USA
1379 Posts

Posted - 10/12/2011 :  1:43:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Seems you are confusing window rename and column rename. The example with exist() is for renaming a window.

Since Windows must have unique Short Names, I used the exist function to make sure such a window does not already exist. If it did, then the Windows Properties dialog would open.

Example 1:
doc -n; // start a new project
newbook; // Add Book2 - project now has Book1 and Book2
win -r Book2 Book1; // This opens properties since rename fails

Example 2;
doc -n;
newbook;
if(exist(Book1)) win -r Book2 Book3;
else win -r Book2 Book1;

Your notation A(x1) suggests you are trying to rename a column, but you are confusing column name (A) and column Plot Designation (X).
I see I did not include a column naming example:
range rc = [Book1]Sheet1!B; //Declare a column range
rc.name$ = 2; // Change the column name to "2"
rc.type = 4; // Change the Plot Designation to X

Go to Top of Page

bafaneh

USA
49 Posts

Posted - 10/13/2011 :  3:57:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks again.
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