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
 looping over hidden datasets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

gfitzgerald

USA
7 Posts

Posted - 07/24/2014 :  4:20:04 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello, All,
I am using Origin 9.0.0 b45
I am trying to loop over all datasets in a project and export them as ascii using LabTalk. When I execute a loop like
doc -e W {type %H}
it shows me 2 workbooks. But I can see 3 graphs. The plot properties show me a graph, with a layer, and 3 plots. Data hierarchy is something like this:
Graph1
- Layer1
-- T1
-- [T2]Sheet1!A(X)B(Y)(1*200)
-- [Book1]Sheet1!(A(X)B(Y)(1*800)

Does this mean that the dataset T1 somehow exists in the graph without being in a workbook? How can I access and export this data?

thanks,
George


Edited by - gfitzgerald on 07/24/2014 4:20:49 PM

jasonzhao

China
262 Posts

Posted - 07/24/2014 :  11:43:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi George,

T1 is a loose dataset in Graph1, You can get the data in T1 by using LabTalk Script below:

string strY$ = T1;  // Name of the loose dataset Y
range dsY = [??]!%(strY$);  // Range to the loose dataset Y
%a = xof(dsY);  // Get the name of loose dataset X
string strX$ = %a;  // Put to a string variable
range dsX = [??]!%(strX$);  // Range to the loose dataset X

newbook result:=tmpbook;  // Create a temp book for loose dataset
range rx = [%(tmpbook$)]1!1;  // 1st column of the book
range ry = [%(tmpbook$)]1!2;  // 2nd column of the book
rx = dsX;  // Put loose dataset X to column 1
ry = dsY;  // Put loose dataset Y to column 2
expASC iw:=[%(tmpbook$)]1! path:="d:\aa.dat";  // Export ascii
win -c %(tmpbook$);  // Delete the temp book


Best regards,
Jason Zhao
OriginLab Tech Service
Go to Top of Page

gfitzgerald

USA
7 Posts

Posted - 07/25/2014 :  12:47:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That is awesome. I found I can even use this for the non-loose datasets using doc -e DY so I can use the same code to handle all of them.

Thanks a bunch.

gxf
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