Author |
Topic |
|
Iole
United Kingdom
4 Posts |
Posted - 04/30/2015 : 11:19:43 AM
|
Dear all,
I am new to Origin LabTalk and I need some help.
I have managed to separate a long column of data into multiple columns on which I can work separately, by using a cycle "for" and the conditioning "if".
What I would like to do is to save each column into a new workBook, that is generated automatically as the cycle is run trough. Any suggestion on how to do that?
Thank you very much in advance, I.
ziffirina |
|
JRoby
USA
6 Posts |
Posted - 04/30/2015 : 4:40:24 PM
|
Doing this within the loop may be difficult since you can only run the code when an extracted column is complete. Perhaps a repeated use of the wxt function which can accept conditions and create a new workbook may be a better approach. Once you have a column to copy to a new book (here the column number is stored in the 'icol' variable), you could use this code:
range raC = $(iCol); // iCol is the column to copy %M = %H; // Remember this workbook newbook; // Create a new book range raD = 1; // or whatever target column you want win -a %M; // Go back to original workbook copy raC raD; // Copy column to new book column
The last two line are interchangeable. |
|
|
Iole
United Kingdom
4 Posts |
Posted - 05/01/2015 : 07:41:45 AM
|
Thank you very much, that worked very well, I have used it to copy and locate more than one column. Do you think is also possible to do operation between them inside the new workbook created? For example say I have copied two column in position number 1 and 2, can I have the sum of the two in column 4, for each new book created?
Thank you very much for your help in advance,
ziffirina |
Edited by - Iole on 05/01/2015 09:57:15 AM |
|
|
JRoby
USA
6 Posts |
Posted - 05/01/2015 : 4:22:03 PM
|
Before you switch back to the 'main' workbook (win -a %M;), you can execute: col(4) = col(1) + col(2);
Alternatively, if you save a workbook where column 4 has a Set Column Values expression of: col(1) + col(2); set to Auto execute, your newbook command can be told to load that template and the sum will occur automatically: newbook template:=MySUMWkBk; // MySUMWkBk.OTW is the template |
|
|
Iole
United Kingdom
4 Posts |
Posted - 05/05/2015 : 09:24:55 AM
|
Thank you very much!!
I have one more question. I inserted in the cycle if the command to create a graph so that all the columns I have separated will be plotted on the same graph. Is it possible to give an instruction so that they will be part of the same group and possibly each xy set of data will be represented by same symbol (preferably small empty circle) but different color?
Thanks again
|
Edited by - Iole on 05/05/2015 09:29:16 AM |
|
|
lkb0221
China
497 Posts |
|
|
Topic |
|