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
 Origin Forum
 Automatic graph naming and importing xls data

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
DrMorbid Posted - 08/19/2014 : 12:53:48 PM
Hello Origin users,

would anyone know how I can make Origin automatically change the long names of my graphs to match the filename? Then I export the graphs as jpg and their names are: <long name> <short name> and this ensure each jpg graph has unique naming, but doing this manually is a bit tedious (transistor characterisation, many devices have to be tested).

Also, I always import data from xls files, but is there any way of automatic it as well? At the moment I have to manually choose Import Excel, then load up the appropriate worksheets and copy the data into the previously existsing sheets within Origin (which contain all the necessary formulas for calculating extra parameters from the measured data).

Thank you very much for help!
2   L A T E S T    R E P L I E S    (Newest First)
DrMorbid Posted - 08/23/2014 : 05:56:36 AM
Thank you very much for your help and introducing me to scripting in Origin! Most of the things I wanted work, just somehow cannot add a new axis onto an existing graph and adding another curve.
greg Posted - 08/19/2014 : 4:57:06 PM
You should be able to use templates to solve both problems.

Long Names follow Sheet Names:
Create one of your graphs.
Add a text object with any text anywhere.
Alt+DoubleClick on the text object to open its Programming Control.
Put this script in the box:

page.label$ = %(1,@WS); // The page label is the Long Name

Set the Script, Run After: to "Axes Rescale" and click OK.
Save this graph as a Template with a new name. (File : Save Template As...)

When you going to create a graph, choose Plot : Template Library and pick your saved Template.


Import Excel for automation:
Take one of your "previously existing sheets" with all your calculations.
Insert a new sheet.
The idea is that you will import your Excel data into this empty sheet of your new analysis template. You will need to add some code to a new column in the second sheet (with all the other calculations) which copies the imported Excel data to the correct columns in the second sheet.
The script (in Before Formula Script of Set Values) might look like this:
range ra1 = 1!1; // First column of first sheet
colcopy irng:=ra1 orng:=1; // Copy to first column of this sheet
range ra2 = 1!2; // Second column of first sheet
colcopy irng:=ra2 orng:=2; // Copy to second column of this sheet
etc.
When you are all set, make the first sheet active and choose File : Save Workbook as Analysis Template and give it an easy name and put it in your User Files Folder.

Here's a batch import script:
dlgfile gr:=Excel mu:=1;
loop(ii,1,fname.GetNumTokens(CRLF))
{
file$ = fname.gettoken(ii,CRLF)$;
doc -o %YMyAnalysisTemplate.ogw; // or your custom path
impexcel
fname:=file$
impmode:=sheet
sheet:=1
options.names.AutoNames:=1;
}

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