T O P I C R E V I E W |
Isch |
Posted - 01/22/2014 : 1:56:01 PM 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! |
5 L A T E S T R E P L I E S (Newest First) |
Isch |
Posted - 03/14/2014 : 2:57:35 PM Thanks Zheng! It works just fine! |
lkb0221 |
Posted - 03/13/2014 : 09:40:27 AM 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 |
Isch |
Posted - 03/13/2014 : 07:51:50 AM 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. |
s_peterson |
Posted - 02/15/2014 : 11:31:44 AM 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 |
lkb0221 |
Posted - 01/22/2014 : 3:12:49 PM 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 |