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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 win -a , loops
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Stefan B

Germany
10 Posts

Posted - 11/13/2016 :  11:40:09 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have 3 problems i cannot deal with.

1. How can i activete a graph previously renamed via string variable? I want to use win -a .

In this example it doesn't work:

string str$;
string str1$;
getn (A) str$ (B) str1$
(ENTER YOUR DATA);
dlgFile group:=ascii;
newpanel name:=str1$;
string wn$ = page.name$;
win -r %(wn$) %(str1$); 
newbook name:= str$ option:=lsname;
...// data importing 
...//plotting
win-a %(str1$); //DOESN'T WORK
..../graph formatting


2. how to do an endless loop (now i have 100 iterations)

Example:
loop(i,1,100){....}


3. How can i stop the loop when user press cancel button in getn window inside the loop , and then do instructions outside the loop ?
Example :
loop(i,1,100)
{
string str$;
string str1$;
getn (A) str$ (B) str1$
(ENTER YOUR DATA);
.......// some instructions
}
.....// instructions when loop is over


Regards,
Stefan Batory

Edited by - Stefan B on 11/13/2016 11:44:24 AM

yuki_wu

896 Posts

Posted - 11/14/2016 :  12:17:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan,

Answer to question 1:

I try the command win –a on my machine, it works nicely. Perhaps you miss a space between win and -a, please try it again. For example:

// it is assume that there is already a workbook named Book2
newbook name:= Test option:=lsname;
string wn$ = page.name$;
string str$="AfterTest";
win -r %(wn$) %(str$);
win –a  book2;
win -a %(str$);

Answer to question 2:

An endless loop may easily create by a While command. However, LabTalk does not have a While command. You can simulate a While loop with the for loop:

//This script continues to prompt for new values 
//until you enter zero or a negative number.
p = 1;
for ( ;p > 0; ) 
getn -s (Enter 0 to quit) p (Next value);

Answer to question 3:

I think the example above is a good answer to this question.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 11/14/2016 05:06:45 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000