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
 Script for Plotting after using Importassistant
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Bladilu

10 Posts

Posted - 10/27/2010 :  10:54:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8.1 and Service Release SR 1
Operating System:Win XP

Hi ,
iam having a problem plotting a second y graph into layer 2 .
My script looks like that :
plotxy iy:=[Book2]Sheet1!(1,12) plot:=202 ogl:=2;
But iam always getting this one :
Failed to resolve range string, VarName = iy, VarValue = [Book2]Sheet1!(1,12)

Dont know whats wrong with the Range?

Column 1 is my X-Axis with time and Col 12 is my Temperature ,which one i want to have in the same Graph ,but with a different scale.

My Intention is to execute a Script at the end of the Importassistant which plots a double YY Graph into a Graphtemplate after the Import.

Hope you can undertand my bad english ;)

Regards Bladilu

greg

USA
1379 Posts

Posted - 10/27/2010 :  11:26:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your code worked fine here when I had a two layer graph active and I had a book named Book2 with at least 12 columns.
By hard coding Book2 you have to make sure your import does not rename it.
It isn't at all clear what the real sequence of events is, but here is an example of a script which imporst a file then plots a double-y plot:
dlgfile gr:=*.dat; // Prompt for file
impasc; // Import
range r1 = 2; // Column 2
range r2 = 3; // Column 3
win -t plot doubley; // Load DoubleY template
plotxy iy:=r1 ogl:=1 plot:=200; // Plot column 2 into layer1 (Line)
plotxy iy:=r2 ogl:=2 plot:=202; // and col 3 into layer2 (line+symbol)
Go to Top of Page

easwar

USA
1965 Posts

Posted - 10/27/2010 :  2:38:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Bladilu,

If you are indeed importing a new file using Import Wizard (assistant) with a graph page active, and want to refer to the book/sheet/columns where the newly imported data goes into, then in your script section on the last page of the assistant, you can use this syntax:range ry=[%(page.name$)](%(layer.name$))!(1,12);

This will then define the range properly and does not have the risk of hard coding the book name, which can fail if other books exist in project with same name etc.

When the script runs, even though the graph is active, the active page at that point is the data book into which the data was just imported.

If this is not you want, then provide more details, or send your opj and your filter to tech support.

Easwar
OriginLab
[/quote]
Go to Top of Page

Bladilu

10 Posts

Posted - 10/28/2010 :  05:35:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Guys ,

thanks for the quick answers! Ill try this out and give you feedback soon.

Bladilu
Go to Top of Page

Bladilu

10 Posts

Posted - 10/28/2010 :  06:03:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
EDIT :

Thats you both !The Problem was the Hard Coding of the Bookname .
I used the script of easwar and now the script works .
This is how it looks like:

col(a) = col(a)*30*21,93;
range ry=[%(page.name$)](%(layer.name$))!(1,12);
plotxy (?,10:11) plot:=192 ogl:=[<new template:=shmgraphkor>];
plotxy iy:=ry plot:=192 ogl:=2;
rescale;

Now it would be nice to rename the plotted graphs by the name of the appertaining Book or Worksheet .How to do that?

And another question :
My rescale only works for the last printed Graph .
When iam importing 5 Datasets+Graphs with this filter ,only the last Graph is scaled.

Thanks
Bladilu
Go to Top of Page

greg

USA
1379 Posts

Posted - 10/28/2010 :  4:07:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Before you create your graph, you can grab the book and or sheet name in a string:

// a Book is a page object and a sheet is a layer object
string str$ = %(page.name$)-%(layer.name$);

After you create your graph, you can rename it:
window -rename %H %(str$);

The layer -a command only rescales the active layer. You could issue the command twice as in:
// BEGIN SCRIPT
plotxy (?,10:11) plot:=192 ogl:=[<new template:=shmgraphkor>];
rescale;
plotxy iy:=ry plot:=192 ogl:=2;
rescale;
// END SCRIPT
or, you could modify the graph template to auto scale:
Select Format : Axes : X Axis to open Axis dialog
On the Scale tab, set Rescale to 'Auto'
Repeat for the Y scale
Repeat both with the second layer
Resave the template
and 'layer -a' will not be needed.
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