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
 range variables in a loop (formatting graph)

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
k_fadz Posted - 10/31/2017 : 07:11:05 AM
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); 

}
4   L A T E S T    R E P L I E S    (Newest First)
k_fadz Posted - 11/02/2017 : 09:26:15 AM
Thank you Yuki. It was the syntax (I was using col$(ii), but the right syntax is col($(ii)).

Thanks

K.F
yuki_wu Posted - 11/02/2017 : 02:16:35 AM
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
k_fadz Posted - 11/01/2017 : 08:54:36 AM
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
yuki_wu Posted - 11/01/2017 : 01:40:55 AM
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

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