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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Reference last rows using a variable

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Clairekun Posted - 06/29/2022 : 6:20:08 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Win10

Hello,

I have a code where I need to add 3 columns to every worksheet and assign a long name and formula to all of them.

The problem is that not all worksheets have the same number of columns. I tried the following, which didn't work:

int ncols = wks.ncols;
col(ncols-2)[L]$ = "Pressure";

This created a new column instead of using the 3rd to last.

How could I do this?

Thank you.
3   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 06/30/2022 : 11:03:27 AM
Much better, thanks!!
aplotnikov Posted - 06/30/2022 : 03:30:32 AM
col($(ncol-2))[L]$="Pressure"
wks.col$(ncol-2).lname$="Pressure"
Clairekun Posted - 06/29/2022 : 7:19:34 PM
I found a way, although there might be a better method.

int end3 = wks.ncols-2; //Assign a different variable to preferred columns
int end2 = wks.ncols-1;
int end1 = wks.ncols;

wcol(end3)[L]$ = "Pressure"; //Use variables in wcol instead of col
wcol(end2)[L]$ = "Time";
wcol(end1)[L]$ = "Temperature";

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000