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
 Origin Forum
 Importing file name as column label

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
oszkoa Posted - 03/11/2004 : 4:30:18 PM
I use Origin mainly to plot measurement data imported from another (non-Windows)computer. If, for example, the changes of a sytem are followed as a function of temperature, it is useful to name the file that contains data, after the temperature at which data were acquired, e.g. 160_K. This way I get 18-20 files to be imported into Origin and set the labels manually after importing them one by one. Though this method works, it is a little boring. So, is it possible to import file in such a way that filenames will be column labels?

Regards, Oszkoa
4   L A T E S T    R E P L I E S    (Newest First)
oszkoa Posted - 03/14/2004 : 2:11:55 PM
Hi easwar,

Million thanks for your help. It works fine!

Oszkoa
easwar Posted - 03/13/2004 : 3:56:58 PM
Hi Oszkoa,

Here is one way to do what you want:

1> Import all files using the multiple ASCII import dialog, setting each file to be imported as additional columns in the worksheet (which I gather is what you are doing now).
2> Keep your imported worksheet active
3> Now open the script window
4> Copy and paste the lines of script code from below, into the script window
5> Click and hold the mouse button and select all the lines of code you just pasted
6> Hit the enter key - this executes all the lines of code

This will change the label of columns corresponding to each file, to the file name (minus the file path and file extension). In this script segment I am assuming that there are two columns of data corresponding to each file. You may need to change that.

If your situation is more complicated, and this (or some simple modification) does not work, please post again.

Easwar
OriginLab.

 
// Script starts here------------
// Get the number of files that were imported
iNum=fdlog.multiopen.count;
// Loop over each file number
for(ii=1; ii <= inum; ii++)
{
// Get the file name
fdlog.get(a,ii,1);
// Assume each file added two columns to the worksheet
jj=(ii-1)*2+1;
// Change label of 1st col for this file to file name
wks.col$(jj).label$=%a;
// Change label of 2nd col for this file to file name
wks.col$(jj+1).label$=%a;
}
// Script ends here -----------


oszkoa Posted - 03/13/2004 : 05:29:56 AM
Hi easwar,

The answers are as follows:

I use Origin 7 SR4 (not pro). The number of files to be imported is typically 17, but varies between 16-20. Each is file is imported into the same worksheet as a new pair of columns, since the range of the X data may also vary a bit.

Thank you for your help.

Oszkoa
easwar Posted - 03/12/2004 : 4:23:15 PM
Hi Oszkoa,

There is no setting to automatically assign the file name to column labels, but this can be done using script commands once the files have been imported.

Can you answer the following questions so that we can then provide you with the right information/script commands for this?

1> what version of Origin are you using?
2> does each file get imported into separate worksheets, or each file comes in as new columns in same worksheet?
3> how many columns (typically) per file?

Thanks,

Easwar
OriginLab.



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