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

Bempel

France
19 Posts

Posted - 11/18/2002 :  06:58:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have to plot 30 graphs every day, and I do this by opening a saved graph, importing the new Ascii file, and saving the project under the same name. Now i'm looking for a method to automatize this, to save time

I will have to write a script, and I don't know how. I would like to have some examples of written scripts.

A few explanations:
The ascii files are *.dat files and their names are aaaaa_xxx, where aaaaa is a name (the same) and xxx is a number, beginning with 1. Column A is always the x-axis and I want to plot columns H and I. But before plotting this two columns, I have to take the absolute value. Futhermore I want to take the mean value of 15 rows of these columns.
I have two versions of Origin : 6.0 in the lab and the 7.0 Demo version at home

Thanks for help

Stephane


Edited by - Bempel on 11/18/2002 07:04:15 AM

CStorey

Canada
137 Posts

Posted - 11/18/2002 :  1:27:38 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stephane,

I have many examples of plotting ASCII data files, here's one that plots columns 17-25 inclusive. I suggest making a simple 25 column datafile and running the script to see how it works. Once you figure out how this works you should be able to manipulate it to fit your needs.

There are a lot of different ways to do similar things in LabTalk, this is but the way I like.

Good luck, and if you need help post your code attempts in the LabTalk forum.
Craig

//////////////////////////////////////////////////////
// Another variation on the plotting theme for Jarl
// 2001/09/26
//////////////////////////////////////////////////////

[Main]
type.redirection=1; /// Redirect "type" commands to Script Window
system.debug=1; /// Display errors
win -t plot line; /// Open a new graph window from a custom template
%R=%H; /// Remember the Graph's Name

// Use a dialog to get the filenames.
// You could easily just set teh path and build a string with all the filenames and skip this step.

FDLog.DlgName$="Select Files to plot.";
FDLog.ShowComment=0;
//FDLog.path$=""; /// Add default path here
FDLog.multiOpen.sort=0;
FDLog.usegroup(ASCII);

If(FDLog.MultiOpen()!=0/0)
{
Loop(ii,1,FDLog.MultiOpen.Count)
{
win -t data wks$(ii); /// open a new worksheet
FDLog.Get(A, ii); //Get next fileName
open -w %A; /// import the first file into the worksheet
%W=%H; /// Remember the Worksheet's Name
#!type "$(ii)) %A, %W"; /// Show active Window Name
%W!wks.col1.type=4; /// Set the 1st column to X-type. No other column to the right should be X type for this to work.

////// Plot columns 17-25 for each worksheet /////

For(jkl=17; jkl<=25; jkl=jkl+1)
{
%U=%(%W,jkl); /// Identify column to plot
run.section(, Plot, %R %U jkl jkl-16 200); /// Plot column as a line in layer1
// Alternately to plot with symbols
// run.section(, Plot, %R %U jkl jkl-17 201); /// Plot column with symbols in layer N
};
};
};

win -a %R; Rescale; /// Rescale the plot.
Legend; /// Add a legend
Return;

//**********************************************************************************//
// Plotting Routine
// Inputs: %1=Plot name, %2=Wks column, %3=colour
// %4=destination layer, %5=symbol type
//**********************************************************************************//
[Plot]

#!type " -->Plotting (Gph=%1 + Column=%2 + C#=%3 + Line#=%4 + Type#=%5)";
win -o %1 {
layer -i%5 %2; //Add layer to graph
set %2 -c %3; //Colour of line + symbol (%5)
if(%4>=12) set %2 -d 2; //Doted lines after 12 colored ones,
if(%4>=24) set %2 -d 1; //then Dashed lines.
};
#!type " -->Plotting...Done!";
Return;
//**********************************************************************************//


Craig Storey
Origin WebRing Member - http://g.webring.com/hub?ring=originwebring
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