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
 loop for defining range variables

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
JamCheck Posted - 11/09/2012 : 04:44:57 AM
Origin Ver. and Service Release: OriginPro 8.6.0 (64-bit) b70 (Academic)
Operating System: MS Windows Server 2008 R2 Standard

Hello,
I am trying to define a lot of range variables, each of them consisting of a column, to create a data sheet which contains the results of a global fitting procedure. One variable (column) is reserved for one parameter and I want to save the differently indexed results in the corresponding cells. In principle, this works, but I encounter problems when I try to define the range variables in a loop:
loop (ii , 1 , 20) {
range c$(ii)=[book1]sheet1!Col($(ii));
}

Thereafter, the variables are not defined. This is especially strange since if I do the same manually, i.e.
ii=1;
range c$(ii)=[book1]sheet1!Col($(ii));
ii=2;
range c$(ii)=[book1]sheet1!Col($(ii));
...

the definitions work perfectly fine. Why is this and how can I do it with the loop?

Thanks a lot for your help,
Jan
2   L A T E S T    R E P L I E S    (Newest First)
JamCheck Posted - 01/07/2013 : 07:10:08 AM
quote:
Originally posted by greg

Variables declared within '{' '}' will go out of scope once you exit.

You can use
@global = 1;
to enforce any following variables to be global in scope.
You can use
@global = 0;
to resume normal scoping rules.



It works perfectly now, thanks for your prompt reply - this was exactly the hint I needed.
greg Posted - 11/09/2012 : 1:16:42 PM
Variables declared within '{' '}' will go out of scope once you exit.

You can use
@global = 1;
to enforce any following variables to be global in scope.
You can use
@global = 0;
to resume normal scoping rules.

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