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
 Plot looping problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Smith_Panther

Germany
5 Posts

Posted - 12/02/2015 :  08:58:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: 8.6.0G (32-bit) Sr3
Operating System: Win 7 32-bit

Hello,

I have a strange issue regarding execution of script fragments inside conditional loops.

For example, I want to plot several curves in to a graph template using the following code:

win -a Book5;
samples = wks.ncols;
win -t plot "%Y\stala_hd_templates\transfer_lin_hd.otp" "Transfer";
for (ii=2; ii<samples-2; ii=ii+3)
{
plotxy iy:=[Book5]1!(1,wCol($(ii))) plot:=200 ogl:=1;
};

If I put this code in an .ogs file and execute it inside the command window typing "run *.ogs" it doesn't work correctly. Only the last curve from the worksheet is beeing plotted. The other iterations of the for loop are missing.

On the other hand, if I put exactly the same code directly into the command window it works perfectly. All curves will be plotted out of each for loop iteration.

So what's the reason for that issue? Why the loop function doesn't work inside an *.ogs file?
At the end I want simply to loop through the worksheet and plot specific columns. However, every file has different amount of columns, so I have to use a loop structure and want to save it in .ogs file to create a button.

I hope somebody can help me to solve this problem. Thanky you very much.

Kind regards,
Smith

Khosrove

Latvia
12 Posts

Posted - 12/02/2015 :  11:15:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Have your tried run.file(*)?
I'm a beginner here, but I had a similiar problem - tried run *.ogs and it didn't loop right, then tried run.file(*) and it went fine. It also worked fine when used as a script for a button.
Go to Top of Page

Smith_Panther

Germany
5 Posts

Posted - 12/03/2015 :  02:59:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much for this hint, it works when I use the run.file() expression!

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