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
 Apply script to selected columns

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
PaulJohns Posted - 11/03/2017 : 5:04:29 PM
I have worksheets that consist of columns of information that I want to perform a function on. The columns vary from file to file, so I would just like to be able to select (with the mouse) the columns that the function should be applied to and then run my LabTalk script on only those (potentially non-adjacent) columns. Is there a way to do this?
4   L A T E S T    R E P L I E S    (Newest First)
nick_n Posted - 11/06/2017 : 1:31:45 PM
You do not have to use [Main] in .ogs
If you use that run.section(ntol, main);
BR, Nikolay

Nikolay
nick_n Posted - 11/06/2017 : 1:21:45 PM
Hi,
Unfortunately, I cannot reproduce that issue.
Try to change your loop: for(ii=1; ii<=NumColumns; ii++) , no needs to use $ substitution
and wks.isColSel(ii) without square brackets.
Best,

Nikolay
PaulJohns Posted - 11/06/2017 : 12:19:54 PM
Thanks. That seems to give me a start. This should be very simple, but I can't seem to get my code to run with any regularity. This is what I have:

[Main]
int NumColumns = wks.ncols;
for(ii=1; ii<=$(NumColumns); ii++;){
	if(wks.isColSel([ii])){
		col($(ii))=1/(col($(ii))*0.000000001/0.01);
	}
}


This code is stored in a file in my user path called ntol.ogs If I go to the Script Window and try to run it, I can get it to work once by typing in ntol; or run.section(ntol); or some other combinations, but then it won't run again, for example if I move to a different sheet, or even if I just select a different column in the same sheet. How do I get it to run again?
nick_n Posted - 11/04/2017 : 7:00:24 PM
Hi,

- wks.c1=; returns index of selected column (or leftmost if there are several selected cols).

- wks.isColSel([colNum]) if you need to know all selected columns (using looping over all columns).

see more at http://www.originlab.com/doc/LabTalk/ref/Wks-obj
Best,



Nikolay

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