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 issue - stops working after cycle 8

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
Quentin Posted - 08/08/2016 : 11:26:15 AM
Hello everyone,

I'm having a strange issue with one of my Labtalk program.

It's a loop over multiple sheets A1, A2, A3...Ahalfcyclenumber.
In every of these sheets they are three columns. If the column Ima is positive then I transform an other column - the first one - with the constant "capa". Capa is actually define on sheets where Ima is negative. Capa is the last value of the 1 column for Ima negative sheets.
( negative and positive sheets alternate)

however, it works fine until cycle 8. Then " capa = col(1)[numpoints]" it's always done considering the col(1) of the A8 sheet... I don't understand why. Anyone has an idea ?

here is the code.

loop(ii, 0, halfcyclenumber)
{ page.active$=A$(ii);
if ( col(Ima)[5]>0 )
{ mathtool iy1:=(col(1)) operator:=sub operand:=const const:=capa;
mathtool iy1:=(col(1)) operator:=mul operan:=const const:=-1;
}
else
{
if (col(Ima)[5]<0)
{
numpoints = wks.nrows;
capa = col(1)[numpoints];
}
else
{
}
};

Quentin
1   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 08/08/2016 : 11:09:42 PM
Hi,

I think you’d better figure out how many worksheets in your workbook at first. Try the scripts below and make sure that there are more than 8 worksheets in your workbook.

Loop (num,1,page.nlayers)   
{
      type "layer number $(num)";
};

On the other hand, I don’t think the loop can start from 0 as your description. You may change it from 1 to halfcyclenumber if you want the loop over sheets A1, A2, A3...Ahalfcyclenumber.

In fact, Origin provides various tools to help you to debug your LabTalk scripts. I think you can find a way to debug your code on this page:
http://www.originlab.com/doc/LabTalk/Tutorials/Tutorial-Debug

Hope it helps.

Yuki
OriginLab

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