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
 file name in origin8.0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

circumvent

Posts

Posted - 01/26/2009 :  8:35:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: Vista

Hi, I got a problem when updating origin from 7.5 to 8.0

In origin7.5,
getfile -m *.*;
loop (ii,1,count)
{
fdlog.Get(A,ii);
open -w %A;}

if I import one file, T1234, The current worksheet will have the name T1234, good for my next analysis. %H=T1234

In origin8.0, it will have a book called book1, then a worksheet named T1234. The problem is, I can not get the information "T1234" through %H now. Does anyone know how to solve the problem, either using different getfile name, or the worksheet has special system name?

Thanks

Jinbo

snowli

USA
1437 Posts

Posted - 01/27/2009 :  4:14:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jinbo,
In Origin 8, we have xfunction impASC to import files and it has more controls than open command. E.g. it can decide if you want to rename book/sheet name or not, remove leading zeros from numbers or not, etc. You can look at the following wiki to see how it works.
http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Accessing_Worksheet_Data%2C_Metadata_%28Labels%29_and_Legend#Open_an_ASCII_File_to_Worksheet_and_convert_to_Matrix

E.g. I changed your script as follows,
getfile -m *.*;
loop (ii,1,count)
{
fdlog.Get(A,ii);
impasc fname:=%A;} //I only changed this line


Thanks, Snow Li
OriginLab Corp.
Go to Top of Page

snowli

USA
1437 Posts

Posted - 01/28/2009 :  09:47:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jinbo,

In 7.5, there is only one sheet in a worksheet window. So usually you can use it's useful to get %H for future analysis.

In 8.0, we support multiple sheets in each workbook, so it may not be necessary to get %H and use it for future analysis. We use range notation to specify Origin objects. E.g. [WindowName]LayerName_or_Index!DataRange, where WindowName can be workbooks, matrix books, graph windows; LayerName_or_Index can be worksheets, matrix sheets, graph layers; and DataRange is the data.
For workbook windows when declaring range variable on the active worksheet, the book and sheet part can be dropped.

E.g.
range ra=2; //specify ra to be the second column of active sheet in workbook
range rb=[book1]1!3; //specify rb to be the 3rd column on first sheet of book1 window, etc.

You can look at the following wiki page for more details of range notation
http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Range_Notation

Thanks, Snow Li
OriginLab Corp.
Go to Top of Page

circumvent

Posts

Posted - 02/01/2009 :  4:49:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Snowli,

Thanks for your help.

By the way, did you actually try the command "impasc fname:=%A" in your computer? In my case, it give error message "#Command Error"

later I only used "impasc", a dialog did open and ask me to select file and import it. Then the following information showed up


impASC.orng = [data]data!A //related to my file name
File1.Header =
File1.SubHeader =
File1.DataRange = Sheet1!A[1]:B[54] //related to my file range


I check "%A=", it will give the file name "%A=C:\whatever\data.txt"
but "impasc fname:=%A;" will give only command error.

I suspect that it might related to the updates. SO I check "Click for updates", origin will tell me that I can only run updates as an administrator. (in Vista) But I already logged in as an administrator.


Jinbo

Edited by - circumvent on 02/01/2009 4:50:18 PM
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/01/2009 :  10:55:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
better way to use impasc is to use the default file name variable fname, as below:

fname$=%A;
impasc;


Not sure why impasc fname:=%A; would not work, but maybe should really be written as

impasc fname:="%A";


as %A might contain spaces. You may check this page to see more examples:

http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Data_Import



CP
Go to Top of Page

circumvent

Posts

Posted - 02/03/2009 :  4:27:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
impasc fname:="%A" works.

Thank you very much, cpyang.


Jinbo
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