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
 Origin Forum
 Index/row numbers found by dotoolbox
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

a_user

USA
0 Posts

Posted - 08/17/1998 :  5:22:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have created a lon macro for the evaluation of a given curve. A small part of this macro is litsd below. /* Sample macro R. Panter 03/1998 */ layer -s 2; dotoolbox 4; ? here I need the statements for the index/row number -> ? given in "dotoolbox" to transform to the variable ? "start" and "ende" of the following statement. M=sum(col(mW.g) -b $(start) -e $(ende)); sum.mean=; nint(sum.mean/5)*5=; sum.n=; sum.total=; nint(sum.total/10)*10=;
Can anybody help me. The manual is not very helpful to solve this problem. Thanks Rainer Panter

a_user

USA
0 Posts

Posted - 08/17/1998 :  5:24:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Using the Data Selector tool with a script

When you use the Data Selector tool, it sets internal variables:
mks1 and mks2
which can then be used in script.

When programmatically accessing the Data Selector it is convenient to re-program the POINTPROC macro to automatically execute a script after a user double-clicks or presses Enter to set the markers.
Here is a basic script that simply reports the row index, X and Y values for each marker.

dotool 4;
def pointproc {
py=%C[mks1];
%A=xof(%C);
px=%A[mks1];
type -a Left marker is at index $(mks1), X is $(px),Y is $(py);
py=%C[mks2];
%A=xof(%C);
px=%A[mks2];
type -a Right marker is at index $(mks2), X is $(px),Y is $(py);
dotool 0;
};

You could use this as the basis for your script, but there are still details you would have difficulty with - specifically, your use of the sum function.

1.The sum function is implemented as a method of the sum object and does not return values; it simply sets the properties of the sum object. Your M=sum(... should therefore simply be sum(....
2.The only allowable argument to the sum function is a dataset name. Your range notation which you got from other LabTalk commands is not allowed in the sum() method. Instead, you can use options of the set command to temporarily set a dataset range:

set Data1_B -bs mks1;
set Data1_B -es mks2;
sum(Data1_B);

3.The Data Selector tool is only available to graph windows. Your argument to the sum() method - col(..) - does not apply since there are no columns in a graph window. You need to use a notation that supplies a full dataset name such as Data1_B.

Here is an example that does something like what you want for the active dataset of the active layer:

dotool 4;
def pointproc {
set %C -bs mks1;
set %C -es mks2;
sum(%C);
Type -a From index $(mks1) to $(mks2), the mean is $(sum.mean);
dotool 0;
};

My use of %C (which contains the active dataset of the active layer) may require modification to work in your circumstances.

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