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
 Simple Data Shifting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jewfrojon@ucf

1 Posts

Posted - 01/14/2013 :  4:59:47 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I feel dumb that I can't figure this out:

I want to "Set Column Values" with a script like "Col(A) - X" where X is the value in Col(A) that coincides with the minimum value for Col(B).
Is there an easy way to do this?

-Jon

JessieWoo

China
46 Posts

Posted - 01/15/2013 :  05:08:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jon,

Im not exactly sure what do you really mean by X is the value in Col(A) that coincides with the minimum value for Col(B), do you mean that you first get the minimum value of Col(B) and its row index, then use the value in Col(A) with the same row index as X? If so, you could define the X with Labtalk script in the Before Formula Script dialog, the detailed procedure is as below:

1. In the Set Column Values dialog, type the following scripts in the Before Formula Scripts text box (click the downward arrow button next to OK if the Before Formula Scripts text box is not opened).

//scripts start
//define a dataset to contain X's index
dataset ds; 
//find the minimum value in Col(B)
dd=min(col(B));
//row indices of the minimum value(s) in Col(B) will be returned to dataset ds
vfind ix:=col(B) value:=dd ox:=ds;
//Get the X value
X=col(A)[ds[1]];
//scripts end

2. Type "col(A)-X" in the set values text box.
3. Click OK.

Best Regard,
Jessie
Originlab Corp.
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