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

Isch

Germany
4 Posts

Posted - 01/22/2014 :  1:56:01 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1. SR2
Operating System: Windows (access from a MacBook)

Hi,

I would to automate data analysis in my project. The project is organized in several workbooks from different measurements. One of them has the reference data in the first cell. I would like to make a loop over all the workbooks, duplicate each worksheet to have a backup and then subtract the reference value in each column.

My questions are:
1) How do I make a loop over all directories and the workbooks inside of them without knowing their names?
2) How do I specify the reference cell? It is just one value from a column.

Thanks in advance!

lkb0221

China
497 Posts

Posted - 01/22/2014 :  3:12:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Igor

1). You can use "document -ef W {script}" to execute the script for all the workbooks under current folder; or use "document -e W {script}" to loop over all books in current project. %H contains the window name in each iteration. For example:
//
document -ef W
{
type %H; // will return all the workbook's name
}
//

2). you can use a substitution notation to specify a workbook cell. For example:
//
double dd = %([%H]1,1,1); // first cell in first sheet of the current workbook
dd = ; // will return the value
//

Zheng
OriginLab

Edited by - lkb0221 on 01/22/2014 3:17:35 PM
Go to Top of Page

s_peterson

USA
1 Posts

Posted - 02/15/2014 :  11:31:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello forum friends
i am new in the forum.
but i must say you people are really doing a great job here,
this forum will be very helpful in my work.
thanks and regards
sam peterson


"The difference between stupidity and genius is that genius has its limits".
Albert Einstein
Go to Top of Page

Isch

Germany
4 Posts

Posted - 03/13/2014 :  07:51:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Zheng! It worked with your help. I agree with Sam, the support in the Forum is excellent!

I have another question regarding the selection of a specific cell. Is it possible to select the last cell automatically? So for instance I want to find the last entered value in the column number 2.
Go to Top of Page

lkb0221

China
497 Posts

Posted - 03/13/2014 :  09:40:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

First, read how many rows are there in col(B) (or your second column):
//
range rr = [%H]1!; // range variable pointing to the the current workbook, first sheet.
int ii = rr.col2.nrows; // Read the number of rows in column 2
//

Then, you can use substitution notation to get the last value.
//
double dd = %([%H]1,2,ii); // Current book, first sheet, second column, row ii.
dd = ;
//

Using "wks.col#.nrows" is not the only way to get the maximum row number, you can also use "dataset.getsize()" or other methods.

Zheng
OriginLab

Edited by - lkb0221 on 03/13/2014 09:41:41 AM
Go to Top of Page

Isch

Germany
4 Posts

Posted - 03/14/2014 :  2:57:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Zheng! It works just fine!
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