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
 range variables in a loop (formatting graph)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

k_fadz

France
11 Posts

Posted - 10/31/2017 :  07:11:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have two problems (parts in red in the code) :

_ I want to delete the ticklabels; the ticks and the labels for all the layers plotted (leave just one and name it "Intensity (a.u)"). I think it could be done by layer.axis.label .. I couldn't do it.

_ I am looking for a way to declare range variables and use them in a loop. I want the Ys axis to start from the minimum of col$(nn$(ii)+3). When I execute my code an error pops up (see screenshot).





range [book1] time=1, mz=4; //declaring the range variables


//Pop up a dialog and enter the M/z to plot
getn 
(M/z) nn1 
(M/z) nn2 
(M/z) nn3
(M/z) nn4 
(M/z) nn5 
(M/z) nn6
(M/z) nn7 
(M/z) nn8 
(M/z) nn9
(M/z) nn10 
(M/z) nn11 
(M/z) nn12
(M/z) nn14 
(M/z) nn15
(M/z) nn16 
(M/z) nn17 
(M/z) nn18 
(Which M/z do you want to plot ?);

//loop to plot each column in distinct layer 

int cnt=0; //counter to avoid zeros

for(ii=1;ii<=18;ii++)
{
if (nn$(ii) == 0) 
{

cnt++;

continue;
};

plotxy iy:=[Book1]!(1,$(nn$(ii)+3)) plot:=200;

// This links Layer ii to Layer1

layer$(ii-cnt).link = 1; 

layer$(ii-cnt).x.link = 1; 

//scale the X axis

layer$(ii-cnt).x.from = min(time); 

layer$(ii-cnt).x.to = max(time); 

//delete Y labels and ticks and tick labels


//scale the Ys

mz = col$(nn$(ii)+3);

layer$(ii-cnt).y.from = min(mz); 

}

Edited by - k_fadz on 10/31/2017 07:12:51 AM

yuki_wu

896 Posts

Posted - 11/01/2017 :  01:40:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi K.F,


Please try the following way:
layer.x.showlabels=0; // Hide tick labels of X axis
layer.x.ticks = 0; // Hide ticks of X axis

More info:
http://www.originlab.com/doc/LabTalk/ref/Layer-Axis-obj

Hope it helps.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 11/01/2017 01:41:21 AM
Go to Top of Page

k_fadz

France
11 Posts

Posted - 11/01/2017 :  08:54:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Yuki it helps. Can you please tell me how to use range variables inside a loop. I use the script below but it doesn't work

mz = col$(nn$(ii)+3);             //scale the y axis, it should begin    
layer$(ii-cnt).y.from = min(mz); //from the minimum value of its column


Thank you so much !

K.F
Go to Top of Page

yuki_wu

896 Posts

Posted - 11/02/2017 :  02:16:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi K.F,

I suppose you to want to do something like this example:
int ncols = wks.ncols; 
for(int ii = 1; ii < ncols; ii++)
{
	int jj = ii + 1;
	range aa = col($(jj));
	double bb = min(aa);
	type "The minimum value is $(bb).";
}

Regards,
Yuki
OriginLab
Go to Top of Page

k_fadz

France
11 Posts

Posted - 11/02/2017 :  09:26:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Yuki. It was the syntax (I was using col$(ii), but the right syntax is col($(ii)).

Thanks

K.F
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