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
 Loop Structure for creating diagrams
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JoeGo87

Austria
1 Posts

Posted - 05/29/2019 :  05:21:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 2019 (64-bit)
9.6.0.172 (Behörde)
Copyright © 1991-2018 OriginLab Corporation

Hello everybody,

I am learning at the moment how to program simple scripts with LabTalk in Origin 2019. My aim at the moment is, to create a row of different line-diagrams with 2 column-datasets in it. The first column should be fixed, the second column should go from col(83) col(end). In each created diagram, the x-values should be rotated 45° and the x-unit should be deleted. The Y-Units should be changed to the text that is the columns unit.

I created the following loop for this, but there is an error when I execute it:

loop (ii, 83, 108) {plotxy iy:=((1,2),(1,$(ii))) plot:=200
layer.x.label.rotate=45
xb.text$ = ""
yl.text$ = %(?Y, @LU);};


If I only execute the first line:
loop (ii, 83, 108) {plotxy iy:=((1,2),(1,$(ii)) plot:=200);};


i get the following error:

plotxy:X-Function failed to execute!
Bad argument, iy:=
((1,2),(1,83) plot:=200)
#Command Error!



Can someone help me here? I know this is probably a simple question, but as I said, I am an absolute beginner.

THank you!

yuki_wu

896 Posts

Posted - 05/29/2019 :  11:38:07 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You put the bracket at a wrong position. It should be:
plotxy iy:=((1,2),(1,$(ii))) plot:=200;


However, even though we correct the bracket position, the script:
loop (ii, 83, 108) { plotxy iy:=((1,2),(1,$(ii))) plot:=200};

means to loop over from 83 to 108 to plot col(1) & col(2) and col(1) & col(i) as a line plot

This might not you want. You could take a look at this page to find more info about how to define the input range:
https://www.originlab.com/doc/X-Function/ref/plotxy

Regards,
Yuki

OriginLab

Edited by - yuki_wu on 05/29/2019 11:38:35 PM
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