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
 choose which columns to plot

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/30/2017 : 04:14:19 AM
Hello,

I am trying to do a labtalk script that opens a window in which I choose the columns to be plotted ... the script would then read the column's I entered and plot them over column 1 (time). In all there's 101 columns (starting from col(2)) named "M/z = 1", "M/z = 2", "M/z = 3" ... "M/z = 101"). I don't have an idea .. Any help would be greatly appreciated

K.F
6   L A T E S T    R E P L I E S    (Newest First)
k_fadz Posted - 10/31/2017 : 10:23:00 AM
Thank you so much Hideo Fujii ! That was it, I missed it.

K.F
Hideo Fujii Posted - 10/31/2017 : 10:11:12 AM
Hi K.F.,

The syntax of plotxy iy:=[Book1]!(1,$(nn$(ii)+3)) plot:=200; seems okay, but your code doesn't have nn13.

Hope this suggestion helps.

--Hideo Fujii
OriginLab
k_fadz Posted - 10/31/2017 : 04:17:47 AM
Sorry I forgot the screenshot. As you see my M/z starts at the 4th column (it continues till column 104 where M/z=101). When I enter 17, 18 and 44 for nn1, nn2 and nn3, the error pops up ... (I have 104 columns in my worksheet though).

I tried the check box, but I think entering the numbers directly is better since I have 101 possible checkboxes.

Thank you so much, you're really helping me

yuki_wu Posted - 10/30/2017 : 10:52:21 PM
Hi K.F,

I am sorry that I cannot find the screenshot. You may forget to upload it.

I guess the error is caused by:
plotxy iy:=[Book1]!(1,$(nn$(ii)+3)) plot:=200;

For example, if I set nn3 = 20, the script above will create a plot with column(1) and column(23). If column(23) doesn’t exist in the active worksheet, an error message will pop up.
BTW, I think checkbox is a better option. For example:
getn 
(column1) nn1:2
(column2) nn2:2
(Which column would you like to plot ?);

Hope it helops.

Regards,
Yuki
OriginLab
k_fadz Posted - 10/30/2017 : 11:53:38 AM
Thank you so much Yuki ! Your answer was really helpful

I am now using this code to draw each column in a distinct layer (I am working on the formatting and will probably make a new topic...).

win -a book1;

//Pop up a dialog and enter the columns index

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 would you like to plot ?);

//loop to plot each column in distinct layer

for(ii=1;ii<=18;ii++)
{
if (nn$(ii) == 0) {continue;}; //zeros are ignored this way

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

nn$(ii)=;

}


I have a problem with the loop (part in red). In the dialog window I have 18 values. When I iterate till 18 to get all the M/z i want to plot there's an error that show up (see screen shot attached). This error disappears if I replace 18 by 13 or less in the loop (for(ii=1;ii<=13;ii++)...). Any suggestions ?



K.F
yuki_wu Posted - 10/30/2017 : 06:49:21 AM
Hi K.F,

You can use GetN funtion to pop up a dialog. For example:

//Pop up a dialog and enter the column index in it
getn (Column Index) nn (Enter the column index to be plotted);
//Check the value of nn 
nn=;

More information please refer to:
http://www.originlab.com/doc/LabTalk/guide/Getting-Numeric-and-String-Input#Get_Multiple_Values
http://www.originlab.com/doc/LabTalk/ref/GetNumber-cmd

Hope it helps.

Regards,
Yuki
OriginLab

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