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 for Programming
 LabTalk Forum
 creating multiple workbooks inside a cycle if

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
Iole 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
5   L A T E S T    R E P L I E S    (Newest First)
lkb0221 Posted - 05/18/2015 : 12:14:51 PM
You can customize the plot each time you added to the graph.
Please see the following Set cmd:
http://www.originlab.com/doc/LabTalk/ref/Set-cmd
Iole 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

JRoby 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 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
JRoby 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.

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