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

gmrudula

4 Posts

Posted - 01/20/2010 :  06:34:02 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am new to origin scripting. I have multiple sets of data with 8 columns in each. The first colmun represents the X axis. I have to draw column graph using 2,3,5 columns. I have to take 5-point moving average of column 4 and 6 and plot as line graph in the same plot. The 7th and 8th column has to be plotted as a line plot. I have 100 such datasets and plotting this manually becomes tedious. Can anyone help me out.

easwar

USA
1964 Posts

Posted - 01/20/2010 :  1:58:42 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

What version of Origin do you have?
Also, where are the "100 datasets"? Do you have them on disk as data files that can be imported, or the data is already in the project in say multiple sheets and there is no way to import it back one by one?

Easwar
OriginLab
Go to Top of Page

gmrudula

4 Posts

Posted - 01/21/2010 :  06:35:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I am using Origin 7

THe datasets are in my harddisk.. Not as origin worksheets
Go to Top of Page

easwar

USA
1964 Posts

Posted - 01/21/2010 :  11:45:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In older version such as 7, there is ave() function to compute average, so you could import one file at a time and create new columns to compute average and then plot them. For plotting a template could be created before hand with the desired settings so that can then be used with new data.

In version 8.1, you can instead use Analysis Templates where you can import one file, do the computation and create output columns, create graphs and embed them into another worksheet, and then save the whole book as a template. Then one can simply use batch processing tool to import multiple files into templates, and then there is no need to program all of this.

You can look at the LabTalk Scripting guide as a start, this guide is written for 8.1, so to try the examples here you can download the demo version of 8.1
http://wiki.originlab.com/~originla/wiki/index.php?title=Category:LT_Guide

Easwar
OriginLab
Go to Top of Page

gmrudula

4 Posts

Posted - 01/21/2010 :  9:40:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hi

will the average function work to find moving averages
Go to Top of Page

greg

USA
1378 Posts

Posted - 01/22/2010 :  10:53:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The average command can be used to create moving averages, and the GUI can be used as well.

With a graph active, you can select "Analysis : Smoothing : Adjacent Averaging" and enter the number of points for the moving average. The dialog does not indicate it, but the number of points should be odd.

With script you can do the same thing. The average command is destructive (overwrites the data being averaged) so work on a copy of the data if you need the original and the smoothed data. Here is an example, assuming a worksheet is active and you want to average column B:
wks.addcol(MovingAve);
copy col(B) col(MovingAve);
average -n 2 col(MovingAve);
Note how the command option leads to the odd number requirement in the GUI, which internally uses the average command. Here, "2" translates to 2 points to the left plus 2 points to the right plus the center point - thus the odd number of points.
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