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
 Multiple Sheets and multiple graphs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

SzymonStudent

Poland
1 Posts

Posted - 11/25/2024 :  9:08:31 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2024b (64-bit) 10.1.5.132 (Student Version) Windows 10

Hi everyone,

I’m a student currently working on my engineering thesis, and I’ve been using OriginLab for data analysis and visualization. I’m trying to automate the process of creating Line+Symbol plots from multiple sheets in a workbook.

Here’s my scenario:

Each sheet is named sequentially as Sheet1, Sheet2, Sheet3, and so on.
Each sheet contains data with X and Y columns.
I’d like the script to iterate through all the sheets, check for the presence of data in the specified columns (e.g., X and Y in "Sheet1"), and generate individual plots for each sheet.
Additionally, for each graph, I need to calculate the area under the curve within the wavelength range of 380-780 nm. Normally, this is done through the Gadgets -> Integrate feature in Origin. After performing the integration, I need the result (the "Area") to be saved to a new workbook for further analysis.

I also have a question about using metadata: Is it possible to read comments from the columns (e.g., from the "Comments" field) and use that information to customize or even determine what data is plotted? For example, could a script check the "Comments" field in a column and then generate the plot based on that metadata?

If anyone has ideas on how to automate both the plotting and integration processes or how to incorporate metadata into the workflow using LabTalk , I’d greatly appreciate your guidance!

Thank you so much for your help!

Best regards,

Edited by - SzymonStudent on 11/25/2024 9:10:34 PM

aplotnikov

Germany
165 Posts

Posted - 11/26/2024 :  07:09:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
https://www.originlab.com/doc/en/Tutorials/Programming
Go to Top of Page

tschunck

Germany
13 Posts

Posted - 12/03/2024 :  11:10:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
open the script window for entering LabTalk scripts.

Make sure that one of your worksheets is active.

Now lets start by looping over your worksheets:
copy the following script to the Script window. Then highlite the Scrip (STRA + a) and press return.

Here is a sample Script:
//################################################################################


%r=%h; // remebers the name of the data window

loop (ii,1,page.nlayers) { // loop over all sheets in the workbook
page.active=ii; // makes sheet ii active
plotxy iy:=4; // plots using assuming e.g. col(4) as input for y and uses the corresponding x-col
// now plot window is open
type -b "Plot-No. $(ii) is done!"; // just to illustrate more commands that you can do
win -a %r; // return to data window;
}; // end of loop command


//################################################################################

You will find a lot of tutorials on web and help files for labtalk include intuitive Skripting examples. Your task should be fullfilled very easily but you have to pick up the new Language.

Good Luck
Peter

Edited by - tschunck on 12/03/2024 11:15:33 AM
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