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
 choose which columns to plot
 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/30/2017 :  04:14:19 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

yuki_wu

896 Posts

Posted - 10/30/2017 :  06:49:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

k_fadz

France
11 Posts

Posted - 10/30/2017 :  11:53:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - k_fadz on 10/30/2017 11:54:32 AM
Go to Top of Page

yuki_wu

896 Posts

Posted - 10/30/2017 :  10:52:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

k_fadz

France
11 Posts

Posted - 10/31/2017 :  04:17:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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


Edited by - k_fadz on 10/31/2017 04:20:49 AM
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 10/31/2017 :  10:11:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

k_fadz

France
11 Posts

Posted - 10/31/2017 :  10:23:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much Hideo Fujii ! That was it, I missed it.

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