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
 Binning in LabTalk

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
AMHumphries Posted - 09/13/2006 : 08:31:27 AM
Origin Version (Select Help-->About Origin): Pro 7.5 SR4
Operating System: Windows XP

Hi folks, sorry to be a nuisance, I'm still getting to grips with LabTalk. I've checked through the documentation and posts on this forum but haven't found anything that quite answers this query.

I have a worksheet containing 10 columns (any number of which, sequentially, will contain data), and each column has the type Y. This is because it is length data, and the X is given by the number of rows (the count data). Within a LabTalk script I want to Bin this data into a new worksheet from which I can plot graphs, etc. I want to be able to select multiple columns to Bin at the same time, which I am not sure I can do with a standard
worksheet -s
statement. I want the end result to be a Binning worksheet containing PopulationStats and Counts (as per usual, Sum and Perc are unnecessary but I don't mind if they are there).

I have tried using
run.section(WKS,2DBinning)
but that gives an error, lookign for an X column as well as the Y... however as stated before, I want the X to be the number of rows each column has containing data. I have also looked through the WKS.ogs script at the Binning section for an idea of how it works, but this has got me no close to solving any of these problems. I also want to specify the Bin size (default 7) without a complicated dialog.

Any help in these matters would be greatly appreciated!

4   L A T E S T    R E P L I E S    (Newest First)
Deanna Posted - 09/15/2006 : 01:10:10 AM
Yep, the Histogram(dataset, inc, min, max) function will be very useful.

Here is a piece of script, which counts the frequency for every selected column and plots the accumulative frequency on a graph page. Before running it, the columns should be selected. Maybe it is not exactly what you want. But I hope that it can examplify one way of using the histogram function.


nCol = wks.c2 - wks.c1 + 1; //Number of columns selected
iLeft=wks.c1;
%w = %h; //Save the input worksheet name

window -t p; //Create a new graph page
%L= %h; //Save the name of the graph page

window -t w; //Create a new worksheet
%m=%h; //Save the worksheet name
wks.col1.type=1; //Set the first column as X

BinSize = 7; //Set the bining size

for (ii=0; ii<nCol; ii++) //Loop over all the selected columns
{
worksheet -a 2; //Add 2 columns

%a = %(%w, iLeft + $(ii)); //Dataset name of an input column
sum(%a); //Find max and min
BinMax = sum.max;
BinMin = sum.min;

IndexCol = $(ii) * 2 + 1;

col($(IndexCol)) = Histogram(%a, BinSize, BinMin - BinSize, BinMax);

//Cummulative frequency
%b=%(%m, $(IndexCol+1)) ;
col($(IndexCol+1))= sum(col($(IndexCol))) ;
col($(IndexCol+1)) /= sum.total;

//Add a data plot
window -o %L {layer.include (%b, 200) ; };
};

//Hide the histogram data
window -h 1;

//Rescale the graph page
window -o %L {layer -a;};


Deanna
OriginLab GZ Office
Hideo Fujii Posted - 09/14/2006 : 10:02:30 AM
Just for anyone's information as a reference, there is a LabTalk function (for 1D frequency counting):
   Histogram(dataset,min,max)

--Hideo Fujii
OriginLab

AMHumphries Posted - 09/14/2006 : 07:45:32 AM
Yes it is still the particle size distribution project. If I can get a population count in "Bins" of 7 with the count for each, from frequency count with which to plot my graph, that'd be great. Is there a built-in frequency count in Origin LabTalk, and if so will it be able to handle multiple column selections as input?

Deanna Posted - 09/14/2006 : 02:22:19 AM
Hi, AMHumphries. run.section(WKS,2DBinning) cannot be applied on multiple columns. I wonder if you are still working on the particle size distribution project. In that case, I don't think you need a 2D binning. You just need a frequency count. If you do need 2D binning, we can modify the 2D binning section in the ogs so that it can be applied on multiple sheets and operate without bringing up a dialog.

Deanna
OriginLab GZ Office

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