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
 variable number in worksheet and column name

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
antarsih Posted - 09/25/2012 : 1:20:54 PM
Hello!
I have several worksheets with similar names, e.g. wks1, wks2, wks3.... Each worksheet includes several columns also with similar names, e.g. data1, data2, data3....

I am wondering if I can somehow replace number in the names with "i" and make a loop? I imagine it could be like this (but with correct syntax):

for (i = 1; i <= 5;i ++)
{
for (ii = 1; ii <= 10;ii ++)
{
wks10_results{i}=wks{i}_data{i}/wks{ii}_data{ii};
};};

I'll be grateful for help.

3   L A T E S T    R E P L I E S    (Newest First)
zevgdimi Posted - 06/25/2015 : 4:21:26 PM
Hello,

I have the same problem but I do not understand the proposed solution. Could you please write the whole code?
To my specific problem: I have 16 columns which shall be named "Pix 1" to "Pix 16", so I would like to combine the string "Pix" with an integer increment.

Thanks
antarsih Posted - 09/27/2012 : 6:11:04 PM
Thanks, Kathy. This information is very helpful!
Kathy_Wang Posted - 09/27/2012 : 01:04:17 AM
Hi,

You could use the following syntax:

range ri = [Book1]wks$(i)!col(data$(i));


The range variable ri will be the datai column(i.e. column short name is datai) in worksheet wksi.

Hope this information helps!

Kathy
Originlab

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